flutter-layout

flutter wrap text instead of overflow

喜你入骨 提交于 2019-12-05 12:13:26
问题 When creating a Text widget with a long string in Flutter, it wraps its text when put directly in a Column. However, when it is inside Column-Row-Column, the text overflows the side of the screen. How do I wrap text inside a Column-Row-Column? And what is the reason for this difference? It would seem logical to me that any child of the upper column would have the same width? Why is the width unbounded? I tried putting the text in Expanded, Flexible, Container and FittedBox, based on other

How to square crop a Flutter camera preview

独自空忆成欢 提交于 2019-12-05 08:19:55
I'm trying to take square pictures in my app. I'm using the camera package and I'm trying to display a centre square-cropped version of the CameraPreview widget. My goal is to show the central square of the preview (full width), with an even amount cropped from the top and bottom. I was struggling to get this to work, so I created a minimal example using a fixed image. (Apologies for the dull picture of me in a chair): import 'package:flutter/material.dart'; void main() => runApp(new MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return

How to create a dotted border around a box in flutter?

落爺英雄遲暮 提交于 2019-12-05 06:32:33
I am building a list of boxes layouts in my app using flutter. I want dotted border around the box. I have used card widget to create the boxes. But, how can I get dotted border around the boxes? EDIT I have added this as a package in pub . Now, all you need to do is DottedBorder( color: Colors.black, gap: 3, strokeWidth: 1, child: FlutterLogo(size: 148), ) Working Solution [Outdated] Like tomerpacific said in this answer , Flutter does not have a default implementation for dashed border at the moment. I worked for some time yesterday and was able to come up with a solution using CustomPainter

flutter:error facing in console. app is automatically closed?

十年热恋 提交于 2019-12-05 04:48:07
问题 After add flowing dependency to my app shared_preferences,image_picker,uuid,image,path_provider,font_awesome_flutter,async,http: any,cached_network_image,firebase_storage its showing me error in console page .. my console error is below ....################################################################################################################################################################################################################################################################

Flutter - The method was called on null

好久不见. 提交于 2019-12-05 02:39:24
I'm programming an app that displays two media streams in the same view via one horizontal listView and one vertical listView . I'm currently working on implementing information into the bottom listView using some nice looking boilerplate that can be found here . I'm new to flutter and have believe my code has gotten a little messy, in short I'm receiving the error; flutter: The following NoSuchMethodError was thrown building Builder: flutter: The method 'loadCurrencies' was called on null. flutter: Receiver: null flutter: Tried calling: loadCurrencies() when trying to implement code found

flutter how to center widget inside list view

别等时光非礼了梦想. 提交于 2019-12-05 00:47:29
I'm struggling with centering widget inside listView . I did like this but Text('ABC') is not centered vertically. How can I achieve this? new Scaffold( appBar: new AppBar(), body: new ListView( padding: const EdgeInsets.all(20.0), children: [ new Center( child: new Text('ABC') ) ] ) ); anmol.majhail Vertically Center & Horizontal Center: Scaffold( appBar: new AppBar(), body: Center( child: new ListView( shrinkWrap: true, padding: const EdgeInsets.all(20.0), children: [ Center(child: new Text('ABC')) ] ), ), ); Only Vertical Center Scaffold( appBar: new AppBar(), body: Center( child: new

How to add line dash in Flutter

孤街浪徒 提交于 2019-12-04 23:10:42
问题 How to make a line dash in Flutter like this? 回答1: As a workaround, in your case, you can do something like this class MySeparator extends StatelessWidget { final double height; final Color color; const MySeparator({this.height = 1, this.color = Colors.black}); @override Widget build(BuildContext context) { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { final boxWidth = constraints.constrainWidth(); final dashWidth = 10.0; final dashHeight = height; final

Flutter tabsView and NestedScrollView scroll issue

半城伤御伤魂 提交于 2019-12-04 21:40:22
i have "NestedScrollView" that content a "tabView" and every tab view content a "List builder" , when i scroll inside one of list builder (inside tabs) , all other tabs is sync the scroll position if i add "ScrollController" to each listview (in tabs) , then the listBuilder inside the tab scroll separated of "NastedScrollView" here is an example code : import 'package:flutter/material.dart'; void main() => runApp( MaterialApp( home: MyApp() , ) ); class MyApp extends StatefulWidget{ MyAppState createState() => MyAppState(); } class MyAppState extends State<MyApp> with

What's the correct way to add splash screen in flutter app?

可紊 提交于 2019-12-04 21:05:02
I am developing a flutter based app and studied there are couple of ways to add splash screen. But I am not sure which one is the best to achieve. import 'dart:async'; import 'package:flutter/material.dart'; import 'package:mingup/screen/login_screen.dart'; // This is the Splash Screen class SplashScreen extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin{ AnimationController _animationController; Animation<double> _animation; @override void initState() { // TODO:

Flutter navigation drawer hamburger icon color change

ぐ巨炮叔叔 提交于 2019-12-04 20:26:08
问题 Hamburger icon color of navigation drawer is not changing. Its black by default. I want to change the this icon color in flutter, I am stuck, help me to change this icon color. here is my code. class Test extends StatefulWidget { @override _TestState createState() => new _TestState(); } class _TestState extends State<Test> { @override Widget build(BuildContext context) { return new Scaffold( drawer: new Drawer(), appBar: new AppBar( title: new Text("Navigation Drawer") ), ), ); } } 回答1: Add