flutter-layout

Remove space top and bottom ListTile flutter

两盒软妹~` 提交于 2020-08-24 06:00:01
问题 I need help, please. How to remove the space top and bottom from ListTile? My Code is: child: Column( children: <Widget>[ ListTile( contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), title: Text( 'Home', style: TextStyle(fontSize: 15.0), ), ), ListTile( contentPadding: EdgeInsets.only(left: 0.0, right: 0.0), title: Text( 'Audio', style: TextStyle(fontSize: 15.0, color: Colors.black45), ), ),), Screenshot Thanks!. Sorry for my bad English 回答1: With ListTile it is not possible. Some

how to implement checkBox in flutter

醉酒当歌 提交于 2020-08-24 05:42:49
问题 Here I have mentioned my code of checkbox. I am new to flutter, So I have to implement it for Remember me functionality. Code: Container( padding: EdgeInsets.all(10.0), child: Column( children: <Widget>[ new Checkbox(value: checkBoxValue, activeColor: Colors.green, onChanged:(bool newValue){ setState(() { checkBoxValue = newValue; }); Text('Remember me'); }), ], ), ); 回答1: If you need a Checkbox with a label then you can use a CheckboxListTile CheckboxListTile( title: Text("title text"),

How to use SizeChangedLayoutNotifier?

与世无争的帅哥 提交于 2020-08-23 09:50:12
问题 I got a Wrap inside my flexibleSpace in my SliverAppBar . Now when the size of my Wrap changes (dynamically) I need to get a notification, so I can change the height of my flexibleSpace in my SliverAppBar accordingly. I read the docs to the SizeChangedLayoutNotifier but I don't really understand how to use it. I wrapped my Wrap as a child in a SizeChangedLayoutNotifier but for me it is very unclear how to catch the notification with the NotificationListener<SizeChangedLayoutNotification> . I

proper way to get widget height in SafeArea

强颜欢笑 提交于 2020-08-22 04:28:57
问题 I'm trying to get the height of widget but it prints the same values I/flutter (19253): full height: 976.0 I/flutter (19253): safe height: 976.0 I guessed the second value should be smaller because the Container placed below the status bar. What I'm doing wrong? I need height because in this container will be Wrap widget (actually ReorderableWrap https://pub.dartlang.org/packages/reorderables#-readme-tab-) with 36 cards, 3 rows by 12 cards and cards height must be 1/3 of its container. I didn

How to create circle on current location in flutter

不羁的心 提交于 2020-08-22 04:20:33
问题 I am working on flutter project.On which I have to draw one circle on my current location on google map.Does any one have idea. I want like this in flutter Thanks in advance. 回答1: This functionality is now available in the google_maps_flutter package: https://pub.dev/documentation/google_maps_flutter/latest/google_maps_flutter/Circle-class.html Partial example: Set<Circle> circles = Set.from([Circle( circleId: CircleId(id), center: LatLng(latitude, longitude), radius: 4000, )]); GoogleMap(

owner._debugCurrentBuildTarget == this , is not true

梦想与她 提交于 2020-08-08 06:31:40
问题 [on web] tried to fit some widgets inside a FittedBox like this : FittedBox( fit: BoxFit.scaleDown, child: AnimatedContainer(...) ) but screen and console show only this message : there's nothing else in the console what's the next step here ? :D 回答1: More Info was provided by the framework after a little messing around with the code , like extra children , random sizes to parents . . . Error >> ... object was given an infinite size during layout ultimately some like this worked : FittedBox(

Both WidgetsBinding.instance.addPostFrameCallback and SchedulerBinding.instance.addPostFrameCallback does wait before the page is build?

╄→尐↘猪︶ㄣ 提交于 2020-08-06 05:22:09
问题 I have the following build codes. What I need is for the first loading to ask for the permission only after the page is completely loaded. But what I notice the is that the permission comes out even before the page is loaded and causes very bad view cause its like stuck between the previous page and current page. How to avoid is this ? I have tried even this SchedulerBinding.instance .addPostFrameCallback((_) Widget build(BuildContext context) { WidgetsBinding.instance .addPostFrameCallback((

How to set default size of macos app in flutter?

大兔子大兔子 提交于 2020-08-05 07:40:17
问题 I am trying to build a macOS desktop app with flutter. I want the app to be full-width, edge-to-edge. However, when I run the app via the simulator, or after the build, it always launches the app with size 800x600. I have set the height and width of the root container to double.infinity. In fact, even if I set the height and width to 10.0, it always launches the app with 800x600. I am new to flutter, so probably missing some fundamentals. Most tutorials I have come across talk about building

Flutter crossAxisAlignment vs mainAxisAlignment

折月煮酒 提交于 2020-07-31 07:26:42
问题 I'm confused about crossAxisAlignment and mainAxisAlignment . Can anyone please explain it in simple words? 回答1: For Row: mainAxisAlignment = Horizontal Axis crossAxisAlignment = Vertical Axis For Column: mainAxisAlignment = Vertical Axis crossAxisAlignment = Horizontal Axis Image source 回答2: Row / Column are associated to an axis: Horizontal for Row Vertical for Column mainAxisAlignment is how items are aligned on that axis. crossAxisAlignment is how items are aligned on the other axis. 回答3:

Custom Painter class not visible in Stack flutter

狂风中的少年 提交于 2020-07-23 10:18:54
问题 For some reason, the Stack widget does not show the Container with the CustomPaint . However if removed from Stack , it works fine. What am I missing here? class _DemoNavBar extends State<DemoNavBar> { @override Widget build(BuildContext context) { // TODO: implement build return MaterialApp( home: Stack( children: <Widget>[ Container(child: CustomPaint(painter: CurvePainter())) ], ) ); } } class CurvePainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { var paint =