Flutter checkbox unwanted touch space. You can use the following example code to create checkbox unwanted touch space.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'NonStopIO', theme: new ThemeData( primarySwatch: Colors.red, ), home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { bool _rememberMeFlag = false; @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('NonStopIO'), ), body: new Container( color: Colors.black38, child: new Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ new Container( margin: new EdgeInsets.symmetric(vertical: 5.0, horizontal: 35.0), color: Colors.white70, height: 50.0, ), new Container( margin: new EdgeInsets.symmetric(vertical: 5.0, horizontal: 35.0), color: Colors.white70, height: 50.0, ), new Container( margin: new EdgeInsets.symmetric(vertical: 5.0, horizontal: 20.0), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ new Row( children: <Widget>[ new GestureDetector( child: new Row( children: <Widget>[ new Checkbox( value: _rememberMeFlag, onChanged: (value) => setState(() { _rememberMeFlag = !_rememberMeFlag; }), ), new Text( "Remember me", style: new TextStyle(color: Colors.white70), ) ], ), onTap: () => setState(() { _rememberMeFlag = !_rememberMeFlag; }), ), ], ), new Container( margin: new EdgeInsets.only(right: 15.0), child: new Text( "Forgot password ?", style: new TextStyle(color: Colors.white70), ), ) ], )), new Container( margin: new EdgeInsets.symmetric(vertical: 5.0, horizontal: 35.0), color: Colors.orange, height: 50.0, ), ], ), ), // This trailing comma makes auto-formatting nicer for build methods. ); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.