美文网首页
Flutter学习之-Progress&手势&TextField

Flutter学习之-Progress&手势&TextField

作者: CocoaJason | 来源:发表于2021-06-10 22:22 被阅读0次

Progress


class ProgressDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(10),
      child: Column(
        children: [
          LinearProgressIndicator(
            value: .5,
            valueColor: AlwaysStoppedAnimation(Colors.red),
          ),
          SizedBox(height: 16),
          Container(
            height: 100,
            width: 100,
            child: CircularProgressIndicator(
              // value: .5,
              valueColor: AlwaysStoppedAnimation(Colors.red),
            ),
          ),
          SizedBox(
            height: 16,
          ),
          CupertinoActivityIndicator(),
        ],
      ),
    );
  }
}

Simulator Screen Shot - iPhone 12 - 2021-06-10 at 22.18.51.png

手势

class ClickDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        print("onTap");
      },
      onDoubleTap: () {
        print("onDoubleTap");
      },
      onLongPress: () {
        print("onLongPress");
      },
      child: Text("Data"),
    );
  }
}

Simulator Screen Shot - iPhone 12 - 2021-06-10 at 22.19.59.png WX20210610-222005@2x.png

文本输入

class InputDemo extends StatefulWidget {
  @override
  _InputDemoState createState() => _InputDemoState();
}

class _InputDemoState extends State<InputDemo> {
  GlobalKey _key = GlobalKey<FormState>();
  TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Form(
        key: _key,
        child: Column(
          children: [
            TextField(
              controller: _controller,
            )
          ],
        ));
  }
}

相关文章

网友评论

      本文标题:Flutter学习之-Progress&手势&TextField

      本文链接:https://www.haomeiwen.com/subject/zikyeltx.html