blog

Flutter 指の動きに追従するウィジェット。

そうでなければ、移動できません。次に、ピボット・ウィンドウのウィジェットの選択で、移動可能なウィジェットを自分で共有します。 child このパラメータは、表示するウィジェットです。 親コンテナはSt...

Nov 5, 2020 · 2 min. read

インターネットをチェックしても利用できません。次に、選択した吊り下げウィンドウウィジェットでリムーバブルウィジェットを共有します。

height このパラメータは、ウィジェットの子ウィジェットのデフォルトy軸位置です。

親コンテナはスタックであることを忘れないでください。


class MoveWidget extends StatefulWidget {
 final Widget child;
 final double height;
 const MoveWidget({Key key, this.child, this.height}) : super(key: key);
 @override
 _MoveWidgetState createState() => _MoveWidgetState();
}
class _MoveWidgetState extends State<MoveWidget> {
 double _bottom = 0.0;
 double _left = 0.0;
 double _right;
 @override
 void initState() {
 _bottom = widget.height;
 super.initState();
 }
 @override
 Widget build(BuildContext context) {
 return Positioned(
 left: _left,
 right: _right,
 bottom:_bottom,
 child: Material(
 color: Colors.transparent,
 child: GestureDetector(
 onPanUpdate: (e) {
 setState(() {
 if(_left !=null){
 _left = _left + e.delta.dx;
 }else{
 _right = _right-e.delta.dx;
 }
 _bottom = _bottom - e.delta.dy;
 });
 },
 onPanEnd: (DragEndDetails details){
 setState(() {
 if(_left !=null){
 if(_left>MediaQuery.of(context).size.width/2){
 _left = null;
 _right = 0;
 }else{
 _left = 0;
 _right =null;
 }
 }else{
 if(_right<MediaQuery.of(context).size.width/2){
 _left = null;
 _right = 0;
 }else{
 _left = 0;
 _right =null;
 }
 }
 if(_bottom <MediaQuery.of(context).padding.bottom){
 _bottom = MediaQuery.of(context).padding.bottom;
 }
 });
 },
 child: widget.child ??
 Container(
 width: 100,
 height: 100,
 color: Colors.red,
 child: Center(child: Text('ビューは追加されない')),
 ),
 ),
 ));
 }
}
Read next

HTTPステータスコード

HTTP はシンプルなリクエスト-レスポンスプロトコルで、通常は TCP の上で動作します。 RFC では、HTTP のステータスコードは「3 桁の数字」であり、最初の桁はレスポンスのカテゴリを定義し、5 つのカテゴリに分類されると規定しています: 1XX: リクエストがサーバーに受け入れられ、サービス中であることを表します。

Nov 3, 2020 · 3 min read