flutter-layout

Showing selected image in alert dialog in flutter

泪湿孤枕 提交于 2020-01-06 09:04:10
问题 How can i show the selected image in my alert dialog ? In my app, i added an alert dialog which has the camera button. When user clicks the camera button, another alert dialog asks to select file from gallery. After the user selects image file from gallery, i want to show the image in the alert dialog with the camera button, but the image shows only after reopening the alert dialog. I have posted my code below. I am new to flutter. Please can someone help me? Thanks in advance. class Test

_TypeError (type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>') flutter

北城余情 提交于 2020-01-06 05:42:32
问题 I have a problem since 2 hours. I have this error, i saw more topics but i can't solve it. The message : _TypeError (type 'List' is not a subtype of type 'Map') flutter My Model : class Theme { int id; String name; Theme({this.id, this.name}); factory Theme.fromJson(Map<String, dynamic> json) { return Theme( id: json['id'], name: json['name'], ); } Future<Theme> getThemes() async { String url = 'http://10.0.2.2:3000/v1/api/theme'; final response = await http.get(url, headers: {"Accept":

How to hook up data from local json to achieve search with autocomplete text in list?

女生的网名这么多〃 提交于 2020-01-06 05:34:04
问题 I am trying to implement input search feature wherein typing a search text will display suggested text and user can select relevant text from list and hit search button to proceed to corresponding screen. The suggested text is in local json and I added it under under assets/ folder and in pubspec.yaml . The search textfield is: The code for above is: new TextField( style: new TextStyle( color: Colors.white, fontSize: 16.0), cursorColor: Colors.green, decoration: new InputDecoration(

How to crop circular(or Square or Hexagon ) area from canvas in Flutter

痞子三分冷 提交于 2020-01-06 04:49:08
问题 I want to crop a rectangular image-file and make it circular or square or hexagon shape and save it as image-file locally . I have a bitmap and I want to crop a circular or hexagon region from this bitmap. All pixels outside the circle should be transparent. How can I do this? I found the similar question in android platform. But unable to find a good resource that really help or direct me to achieve this in flutter. Please share me the idea to achieve this result. 回答1: Use Clipper to crop

Is there a way to disable PageView clipping effect?

那年仲夏 提交于 2020-01-05 13:09:28
问题 Let say I have a PageView sized {100x100} with 4 children, so there will be only 1 child visible at the time, until I scroll to the second child. What I want is to make all 4 children are visible on the screen. Is there a way to achieve this? 回答1: Answering my own question is kind of funny, but I'm doing it anyway, thought that someone might need this. Thanks to this post: Non-center alignment for PageView with viewportFraction < 1.0 Now I can apply PageScrollPhysics() to a ListView to

Is there a way to disable PageView clipping effect?

怎甘沉沦 提交于 2020-01-05 13:09:13
问题 Let say I have a PageView sized {100x100} with 4 children, so there will be only 1 child visible at the time, until I scroll to the second child. What I want is to make all 4 children are visible on the screen. Is there a way to achieve this? 回答1: Answering my own question is kind of funny, but I'm doing it anyway, thought that someone might need this. Thanks to this post: Non-center alignment for PageView with viewportFraction < 1.0 Now I can apply PageScrollPhysics() to a ListView to

I want to change the color of CustomListTile which is child of ListView when onTap is clicked, and setting other children color into default one?

拥有回忆 提交于 2020-01-05 08:28:19
问题 In a Drawer, in listview want to change the color of CustomListTile when the onTap is clicked and setting color of all other children to default? class CustomListTile extends StatelessWidget { final Color itemContainerColor; const CustomListTile({ //deafult color is Colors.white this.itemContainerColor= Colors.white, }); @override Widget build(BuildContext context) { return InkWell( onTap: (){}, child: Container( margin: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric

How to design a Text Widget that wraps automatically in flutter?

别等时光非礼了梦想. 提交于 2020-01-05 08:10:29
问题 I want to design a text widget that wraps automatically, and it uses an ellipsis when the text length exceeds the maximum. The following code can achieve a similar effect. Container( color: Colors.red, child: Text( 'DENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATIONDENTIFICATION', overflow:

How to position elements inside a ListView?

牧云@^-^@ 提交于 2020-01-05 07:01:13
问题 Good morning. I made this screen and it works like a charm on high resolutions. Problem is, I want to support lower resolutions like Nexus 4 (768x1280). So when I run this on an emulator (Nexus 4 size) and I touch the input fields, the keyboard either: blocks the inputs, or moves the two buttons at the bottom and overlaps them on something else. So, to solve it I wrapped the entire layout on a ListView(), but now the bottom buttons, which are wrapped on a Row(), just won't stay at the bottom.

How to validate text input on alertDialog using Form and GlobalKey?

∥☆過路亽.° 提交于 2020-01-05 04:00:46
问题 I've a textfield on alertDialog which accepts Email and want to validate it. The alertDialog opens in front of current login screen after tapping on forgot password button. I've implemented login validation and was trying to use similar logic to achieve above. For login validation, I used GlobalKey (_formKey) and Form widget which works perfectly. I am using another GlobalKey named _resetKey to get the currentState of validation and then saving it's state. Although this approach is working, I