flutter-layout

How to change status bar color in Flutter?

坚强是说给别人听的谎言 提交于 2019-12-17 09:37:01
问题 I am trying to change the status bar color to white. I found this pub on flutter. I tried to use the example code on my dart files. 回答1: Works totally fine in my app import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { FlutterStatusbarcolor.setStatusBarColor(Colors.white); return MaterialApp( title: app_title, theme: ThemeData( primarySwatch: Colors.blue, ),

Position cursor at end of TextField when focused?

蹲街弑〆低调 提交于 2019-12-13 17:32:58
问题 I have a TextField which has a default text in it from the beginning. I want the cursor to be placed at the end of the existing text when the TextField receives focus (possibly with the condition that the text should not have already been modified from the default text). I've tried setting the controller.selection which didn't work. I also tried using a FocusNode : focusNode: FocusNode()..addListener((){ if( !record.isCommentModified ) record.textEditingController.selection = TextSelection

flutter ListView KeepAlive after some scroll

☆樱花仙子☆ 提交于 2019-12-13 16:08:20
问题 I want to keepAlive my widgets which are already rendered in ListView . I was tried with addAutomaticKeepAlives:true properties which provide by ListView class. Here is my sample code which I was used. Same issue in SliverChildBuilderDelegate delegate which provide by SliverList . ListView.builder( itemBuilder: (context,index){ return Card( child: Container( child: Image.asset("images/${index+1}.jpg",fit: BoxFit.cover,), height: 250.0, ), ); }, addAutomaticKeepAlives: true, itemCount:40 , );

Flutter: What is the correct way to detect touch enter, move and exit on CustomPainter objects

守給你的承諾、 提交于 2019-12-13 15:55:37
问题 I am beginner in Flutter and I am trying to figure how I can detect touch enter, move and exit when a user runs their finger across a custom shape and/or across multiple stacked custom shapes. Something like below Ideally I would like to get touch events when users enter/exit pixel boundaries of each custom shape, but I wanted to get it working at-least with a MBR of the shapes. Below is the code that I have. What am I doing wrong? All it seems to do is print move when touch begins within the

Drop down button in flutter not switching values to the selected value

拥有回忆 提交于 2019-12-13 11:43:22
问题 I've recently started programming using dart and flutter and everything has been going smoothly for my app, although recently i wanted to add drop down menu to provide the user with multiple options to pick from. everything worked as planned however when i pick a value from the list it doesn't change the value in the box, it goes back to the hint or an empty box. any help would be appreciated! here is my code for the dropdownbutton: Widget buildDropdownButton() { String newValue; return new

Fullscreen GridView in flutter

╄→尐↘猪︶ㄣ 提交于 2019-12-13 08:36:40
问题 I'd like to achieve a bidirectional Pageview or a fullscreen Gridview. i.e. The layout would look like this. | | | | | | _____|_______|_______|____ | | | | | | .....| i,j | i+1,j |..... | | | | | | _____|_______|_______|_____ | | | | | | .....| i,j+1 |i+1,j+1|..... | | | | | | _____|_______|_______|_____ | | | | | | | | | Each i,j represents a fullscreen. Thus, the viewport of the device will only be able to view a particular (i,j) at any point in time. And from that position on swiping the

Flutter: Giving equal width to two buttons in a ButtonBar with dynamic height for long text

耗尽温柔 提交于 2019-12-13 03:59:27
问题 So here's my simple use case: I want to have two buttons next to each other horizontally. In native android (which is where I come from) I would have placed them in a LinearLayout and given them weight 1 each and setting their height to wrap_content . Now, I have placed two RaisedButton in a ButtonBar widget but where I run the app I can see the second one is getting clipped. I want them to be equally spaced and have dynamic height as per their text. How can I achieve the same in flutter?

Detect vertical swipe direction in Flutter

大兔子大兔子 提交于 2019-12-13 03:54:12
问题 How to detect when the user swipe vertically either upward on downward? I have been using swipedetector package, but now, it gives me exceptions like The getter 'globalPosition' was called on null. 回答1: import 'package:flutter/material.dart'; class SwipeDetectorExample extends StatefulWidget { final Function() onSwipeUp; final Function() onSwipeDown; final Widget child; SwipeDetectorExample({this.onSwipeUp, this.onSwipeDown, this.child}); @override _SwipeDetectorExampleState createState() =>

Proper page navigation

那年仲夏 提交于 2019-12-13 03:24:27
问题 I am trying to navigate to a page called contactView. I have made a list of contacts and I wait to navogate to a contact when I click on there name. This is what I have so far. I am stuck trying to get the navigation to work. Any help would be great. class ContactList extends StatelessWidget { final List<Contact> _contacts; ContactList(this._contacts); @override Widget build(BuildContext context) { return new ListView.builder( padding: new EdgeInsets.symmetric(vertical: 8.0), itemBuilder:

Flutter Bottom Sheet: How to change height when user interacts with the sheet

淺唱寂寞╮ 提交于 2019-12-13 03:23:06
问题 In my flutter application I have a bottom sheet which gets shown with some initial height say 100. I would like to increase the height of the sheet (say may be 500 or go full screen) when user interacts with it (may be a gesture detection or clicking on a button on the sheet) Is it possible to change the height of the sheet after it is loaded. My bottomsheet is something like Widget _bottomSheetContainer(BuildContext context) { return Container( height: 100, decoration: BoxDecoration( border: