flutter-layout

How to overlap SliverList on a SliverAppBar

妖精的绣舞 提交于 2020-04-29 08:16:24
问题 I'm trying to overlap a SliverList a few pixels over the SliverAppBar . Similar to this post. I'd like the image in the FlexibleSpaceBar to go under the radius of my SliverList . I'm attempting to achieve the below. I can only get the radius like so. Without the ability to overlap the SliverList onto he SliverAppBar . @override Widget build(BuildContext context) { return Scaffold( body: CustomScrollView( slivers: <Widget>[ SliverAppBar( floating: false, expandedHeight: MediaQuery.of(context)

ListTile does not show radio buttons

佐手、 提交于 2020-04-18 05:47:59
问题 I want to display 2 radio buttons horizontally on the subtitle of the ListTile. I can see only one Radio Button List<QuestionsOptions> optionsList = [ QuestionsOptions( index: 1, name: "Yes", ), QuestionsOptions( index: 0, name: "No", ), ]; 回答1: You need to use the Horizontal listview of the flutter by the help of the ListView.builder and set the scrollDirection: Axis.horizontal for the horizontal scroll and for the checkbox we need to use the RadioListTile for the radio button with text

Easy way to hide a widget after some duration in Flutter

不羁岁月 提交于 2020-04-18 03:51:50
问题 I have used flutter_offline library to display the offline and online message. The problem is that I want to hide the online message after some time. I can't figure out a way to remove a container when the status is connected but after some duration. Below is my code: body: OfflineBuilder( connectivityBuilder: ( BuildContext context, ConnectivityResult connectivity, Widget child, ) { final bool connected = connectivity != ConnectivityResult.none; return SingleChildScrollView( scrollDirection:

Removing item from list Flutter

a 夏天 提交于 2020-04-18 00:47:25
问题 I have a function which updates elements of a widget. It updates all lists apart from the note list which adds the new element but does not delete the old one. Here is the code where I callback a function which takes the value at index, removes it and then adds the new value and then navigates back to a different page: Function(int) onEditExercise = (int val) { setState( () { print(val); print("repExListBefore: ${widget.repExList}"); widget.repExList.removeAt(val); print("freqListBefore: $

Flutter dropdown menu with ListTiles and row of Buttons

青春壹個敷衍的年華 提交于 2020-04-17 22:23:59
问题 I'm trying to build out a custom dropdown menu that looks like this: I've managed to implement the ListTiles and Row of Buttons without the dropdown, but I'm not sure how to nest all of that within a dropdown menu class. This is what I've got so far: class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( drawer: Drawer(), body: SizedBox.expand( child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children:

How can I refresh the brew list?

混江龙づ霸主 提交于 2020-04-17 20:27:19
问题 The brew list does not refresh with this refreshList function. What is the problem with the function ? It needs to refresh the list and fetch the most recent list from the firestore but it does not load the changes until I hot reload. class BrewList extends StatefulWidget { @override _BrewListState createState() => _BrewListState(); } class _BrewListState extends State<BrewList> { List<Brew> brews; Future<dynamic> refreshList() async { await Future.delayed(Duration(seconds: 1)); setState(() {

How can I refresh the brew list?

会有一股神秘感。 提交于 2020-04-17 20:27:18
问题 The brew list does not refresh with this refreshList function. What is the problem with the function ? It needs to refresh the list and fetch the most recent list from the firestore but it does not load the changes until I hot reload. class BrewList extends StatefulWidget { @override _BrewListState createState() => _BrewListState(); } class _BrewListState extends State<BrewList> { List<Brew> brews; Future<dynamic> refreshList() async { await Future.delayed(Duration(seconds: 1)); setState(() {

How can I refresh the brew list?

左心房为你撑大大i 提交于 2020-04-17 20:25:27
问题 The brew list does not refresh with this refreshList function. What is the problem with the function ? It needs to refresh the list and fetch the most recent list from the firestore but it does not load the changes until I hot reload. class BrewList extends StatefulWidget { @override _BrewListState createState() => _BrewListState(); } class _BrewListState extends State<BrewList> { List<Brew> brews; Future<dynamic> refreshList() async { await Future.delayed(Duration(seconds: 1)); setState(() {

How to set the fixed height of the container inside the GridView.builder? should not depending on childAspectRatio

情到浓时终转凉″ 提交于 2020-04-16 08:21:06
问题 Actually I am trying to show a list of products inside the GridView.builder, but it's height changing as per childAspectRatio as per different devices of different heights. I want to fix them for every device... 回答1: I had the same issue and ended up calculating the childAspectRatio so that each cell ends up having the height that I want. double cellWidth = ((MediaQuery.of(context).size.width - allHorizontalPadding) / columnCount); double desiredCellHeight = 200; double childAspectRatio =

How to set the fixed height of the container inside the GridView.builder? should not depending on childAspectRatio

和自甴很熟 提交于 2020-04-16 08:19:39
问题 Actually I am trying to show a list of products inside the GridView.builder, but it's height changing as per childAspectRatio as per different devices of different heights. I want to fix them for every device... 回答1: I had the same issue and ended up calculating the childAspectRatio so that each cell ends up having the height that I want. double cellWidth = ((MediaQuery.of(context).size.width - allHorizontalPadding) / columnCount); double desiredCellHeight = 200; double childAspectRatio =