dart

How to set size to FloatingActionButton

浪尽此生 提交于 2021-02-07 11:16:05
问题 I'm trying to set a size to a FloatingActionButton in flutter, I wanna set width / height , I mean, make the button bigger, I was looking for a circular button, but the only one that I got was this one, so, I started to work with this, but I need it a little bigger. 回答1: Use a Container where you can specify width and height , then use a RawMaterialButton , like this: myFabButton = Container( width: 200.0, height: 200.0, child: new RawMaterialButton( shape: new CircleBorder(), elevation: 0.0,

How to set size to FloatingActionButton

馋奶兔 提交于 2021-02-07 11:15:02
问题 I'm trying to set a size to a FloatingActionButton in flutter, I wanna set width / height , I mean, make the button bigger, I was looking for a circular button, but the only one that I got was this one, so, I started to work with this, but I need it a little bigger. 回答1: Use a Container where you can specify width and height , then use a RawMaterialButton , like this: myFabButton = Container( width: 200.0, height: 200.0, child: new RawMaterialButton( shape: new CircleBorder(), elevation: 0.0,

How to access Stateful widget variable inside State class outside the build method?

半城伤御伤魂 提交于 2021-02-07 10:52:43
问题 I am trying to access the 'updateNotesModel' variable declared in the code in the _UpdateNotesState. I found out that you can do it using the 'widget' keyword as shown in the Scaffold below. But the problem here is that I am trying to access the variable outside the build method in order to give the TextEditingController a default value. How can I achieve this? class UpdateNotes extends StatefulWidget { final NotesModel updateNotesModel; UpdateNotes({Key key, this.updateNotesModel}): super

change the datetime format in flutter, to leave it only with the date

非 Y 不嫁゛ 提交于 2021-02-07 10:15:41
问题 I would like to know how I can change the datetime format in flutter, to leave it only with the date. I also want to know if there is another widget that only contains the date. Thanks 回答1: You can use DateFormat from intl package. With it you can custom to any format that you need. Add to pubspec.yaml dependencies: intl: ^0.15.7 On Dart code: import 'package:intl/intl.dart'; final dateFormatter = DateFormat('yyyy-MM-dd'); final dateString = dateFormatter.format(DateTime.now()); Then you can

Handling grapheme clusters in Dart

℡╲_俬逩灬. 提交于 2021-02-07 07:20:32
问题 From what I can tell Dart does not have support for grapheme clusters, though there is talk of supporting it: Dart Strings should support Unicode grapheme cluster operations #34 Minimal Unicode grapheme cluster support #49 Until it is implemented, what are my options for iterating through grapheme clusters? For example, if I have a string like this: String family = '\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}'; // 👨‍👩‍👧 String myString = 'Let me introduce my $family to you.'; and there is a

How to store list of object data in sqlite on Flutter?

别说谁变了你拦得住时间么 提交于 2021-02-07 07:20:30
问题 How to store a list of object data in SQLite on Flutter? Json data coming with API. { "images": [ { "id": 10, "name": "img1" }, { "id": 11, "name": "img2" } ] } 回答1: use flutter sqlite package make helper class for db operations and model class example here parse json and insert or update data 来源: https://stackoverflow.com/questions/55232650/how-to-store-list-of-object-data-in-sqlite-on-flutter

Implementing MQTT in Flutter

倖福魔咒の 提交于 2021-02-07 07:19:43
问题 I am new to Flutter (coming from Android background) and want to implement MQTT client in flutter. This is what i want: MQTT client which should be "alive" when the app is open/not killed by OS. I don't want to run it in background (without the app open, i know there is issue doing it in iOS, read it somewhere) but while the app is open. Updating UI/State based on messages coming in subscribed topics. I looked into pub and found 2 packages, mqtt and mqtt_client, they look like non-Flutter

preload assets images before build

荒凉一梦 提交于 2021-02-07 06:50:15
问题 am trying to set background image of my container to image from assets like this: return new Container( decoration: new BoxDecoration( image: new DecorationImage( image: new AssetImage(images[index]), fit: BoxFit.cover, ), ), but this will take some time to load and return blank whilte screen till image load .. so i tried to preload images before build like this: @override void initState() { precacheImage(new AssetImage(images[1]), context); precacheImage(new AssetImage(images[2]), context);

Multiple rows in body of flutter application

时间秒杀一切 提交于 2021-02-07 06:46:26
问题 I am trying to create a screen in flutter that has 3 rows stacked on top of each other but I keep getting syntax errors. I have tried multiple containers in the body, Rows etc and keep getting syntax errors, is what im trying to do impossible? I would think Rows would be stackable, or at least containers in a body. Here is the code: import 'package:flutter/material.dart'; class Index extends StatelessWidget { @override Widget build(BuildContext context) { // TODO: implement build return new

Flutter - ListView.builder with very large size and does not change

放肆的年华 提交于 2021-02-07 06:16:44
问题 How can I decrease the size of items using the ListView.builder I already tried to tinker with everything in ItemCategory but the size remains the same. Using the ListView the size is the smallest good according to this images below: Using the Flutter - Strange ListView behavior after refresh code the items are well-sized, but by changing the ListView to ListView.builder the size changes completely and the ItemCategory class is the same without ListView.builder with ListView.builder import