flutter-layout

How to center gridView items in Flutter?

此生再无相见时 提交于 2020-04-16 03:53:36
问题 I have a 4*4 grid view, but sometimes instead of 16 items there might only be 15 items, to the last row looks not so nice... I am wondered is there any way to center items in gridView row? Or there might be some other solution which can solve my task? 回答1: as an option you can use Wrap widget instead of Grid here is an example import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return

How to center gridView items in Flutter?

我的梦境 提交于 2020-04-16 03:53:14
问题 I have a 4*4 grid view, but sometimes instead of 16 items there might only be 15 items, to the last row looks not so nice... I am wondered is there any way to center items in gridView row? Or there might be some other solution which can solve my task? 回答1: as an option you can use Wrap widget instead of Grid here is an example import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return

How to set dynamic height for dropdown popup in flutter

瘦欲@ 提交于 2020-04-13 07:46:55
问题 I am new to flutter development. I am using the dropdown button of my application. When opening the drop-down menu, the text is getting cut in the popup dialog. Below I attached a screenshot with coding. Please guide me in fixing this issue. DropdownButtonHideUnderline( child: new DropdownButton( isExpanded: true, value: dropDownValue, isDense: true, //icon: Icon(Icons.keyboard_arrow_down, color: Colors.white,), onChanged: (String newValue) { setState(() { dropDownValue = newValue; state

How to set dynamic height for dropdown popup in flutter

我是研究僧i 提交于 2020-04-13 07:46:12
问题 I am new to flutter development. I am using the dropdown button of my application. When opening the drop-down menu, the text is getting cut in the popup dialog. Below I attached a screenshot with coding. Please guide me in fixing this issue. DropdownButtonHideUnderline( child: new DropdownButton( isExpanded: true, value: dropDownValue, isDense: true, //icon: Icon(Icons.keyboard_arrow_down, color: Colors.white,), onChanged: (String newValue) { setState(() { dropDownValue = newValue; state

Inner shadow effect in flutter

社会主义新天地 提交于 2020-04-11 03:58:11
问题 According to the github issue there is no inset attribute in ShadowBox yet. Is there any workaround how to emulate inner shadow right now in flutter. I like to achieve inner shadow effects like you can see on the following images 回答1: decoration: BoxDecoration( color: Colors.transparent, boxShadow: [ const BoxShadow( color: your_shadow_color, offset: const Offset(0.0, 0.0), ), const BoxShadow( color: your_bg_color, offset: const Offset(0.0, 0.0), spreadRadius: -12.0, blurRadius: 12.0, ), ], )

Inner shadow effect in flutter

最后都变了- 提交于 2020-04-11 03:57:31
问题 According to the github issue there is no inset attribute in ShadowBox yet. Is there any workaround how to emulate inner shadow right now in flutter. I like to achieve inner shadow effects like you can see on the following images 回答1: decoration: BoxDecoration( color: Colors.transparent, boxShadow: [ const BoxShadow( color: your_shadow_color, offset: const Offset(0.0, 0.0), ), const BoxShadow( color: your_bg_color, offset: const Offset(0.0, 0.0), spreadRadius: -12.0, blurRadius: 12.0, ), ], )

How to scroll page in flutter

心已入冬 提交于 2020-04-07 14:28:22
问题 My code for a page is like this. i need to scroll part below appbar. @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar(... ), body: new Stack( children: <Widget>[ new Container( decoration: BoxDecoration( image: DecorationImage(...), new Column(children: [ new Container(...), new Container(...... ), new Padding( child: SizedBox( child: RaisedButton(..), ), new Divider(), new Column( children: <Widget>[ new Container( child: new Row( children: <Widget>[ new

How to set the list of json data inside list in the Listview.builder in flutter?

↘锁芯ラ 提交于 2020-04-01 02:49:53
问题 I am new to flutter. I have converted my json to pojo from here . My api is below. I am able to get the data from api but there are 3 food items in the Orderdata but I am only able to get value of only index 0 which is shown in image below: I have implemented as follows: { "status": "success", "message": "Data Fetched", "data": { "list": [ { "id": 174, "order_code": "mkjrovcjjrvra6t3vtgo58", "chef_id": 1, "user_id": 58, "order_status": 2, "status": 3, "order_datetime": "2020-02-27 10:25:28",

How to set the list of json data inside list in the Listview.builder in flutter?

元气小坏坏 提交于 2020-04-01 02:49:31
问题 I am new to flutter. I have converted my json to pojo from here . My api is below. I am able to get the data from api but there are 3 food items in the Orderdata but I am only able to get value of only index 0 which is shown in image below: I have implemented as follows: { "status": "success", "message": "Data Fetched", "data": { "list": [ { "id": 174, "order_code": "mkjrovcjjrvra6t3vtgo58", "chef_id": 1, "user_id": 58, "order_status": 2, "status": 3, "order_datetime": "2020-02-27 10:25:28",

Flutter: Using Expandable Textfield with BottomNavigationBar

牧云@^-^@ 提交于 2020-03-25 19:14:33
问题 I need some help with this layout :) The Layout contains a BottomNavigationBar . The body consists of a Container at the top (which serves as some kind of header) and a Textfield below the Container . The Textfield should expand to fill the remaining space. As soon as the user enters enough lines so that the text doesn't fit on the screen, the whole body ( Textfield and Container ) should become scrollable . So it's basically a note app with a Header (the Container part) and multiple Tabs for