flutter-layout

Non-center alignment for PageView with viewportFraction < 1.0

馋奶兔 提交于 2019-12-10 09:30:54
问题 When you create a PageView with a viewportFraction value of <1.0 for the PageController, the pages are snapped to the center of the viewport, like so: I want the current pages to be snapped to the top of the viewport, while the next page is rendered under the bottom bar. I've tried applying a transform to each page: Transform.translate(offset: Offset(0.0, -36.0), child: page) This appears to work at first glance (see first image), but fails to render the next page when it would be hidden

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

非 Y 不嫁゛ 提交于 2019-12-10 04:06:50
问题 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? 回答1: 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

Flutter - Add new Widget on click

杀马特。学长 韩版系。学妹 提交于 2019-12-09 23:03:01
问题 I'm new to flutter and I'm trying to build a rather simple app. I have this simple (and still in progress) code and I'm trying to add a new Widget every time the user clicks a button. Here's my code: class ResponsavelProfilePage extends StatefulWidget { @override _ResponsavelProfilePageState createState() => new _ResponsavelProfilePageState(); } class _ResponsavelProfilePageState extends State<ResponsavelProfilePage> { int _count = 1; @override Widget build(BuildContext context) { List<Widget

Vertical viewport was given unbounded height error

不问归期 提交于 2019-12-09 09:18:48
问题 @override Widget build(BuildContext context) { return Column( children: <Widget>[ new Text("Some text"), ListView() ], ); } Widget ListView() { return ListView( padding: EdgeInsets.symmetric(vertical: 8.0), children: Item(), ); } List<Item> Item() { return list .map((item) => Item(text: item)) .toList(); } class Item extends ListTile { Item({String text, GestureTapCallback onTap}) : super(subtitle: Column(children: <Widget>[ Text(text), ])); } A blank space appears on the screen and the

How to navigate to a specific flutter route from an Android activity?

折月煮酒 提交于 2019-12-09 06:46:22
问题 I have an existing android application and i have integrated flutter in my project i want to call a flutter specific route which i define in my main method like this class FlutterView extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Platform View', initialRoute: '/', routes: { '/': (context) => HomeScreen(), '/secound': (context) => MyCustomForm(), '/dashboard': (context) => DashBoardScreen(), '/login': (context) => LoginScreen(), },

Flutter: Drag and drop with Grid

为君一笑 提交于 2019-12-09 06:21:59
问题 I want to create a widget where you can add multiple widgets with different sizes and you can change their position by using the drag and drop technique. Something like a grid view with drag and drop where you can change the position both horizontally and vertically. While you are dragging the selected widget, other widgets will move around to open up space for it. Does anyone have any suggestion where to start or are there already some examples which are implementing what I am looking for?

No Directionality widget found

允我心安 提交于 2019-12-09 05:04:44
问题 I am trying to create a simple layout in flutter but keep getting this error: The following assertion was thrown building Text("Deliver features faster", textAlign: center): No Directionality widget found. I think the problem may be in the TextDirection class property, but I have been unable to find it. Here is my code: import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; void main(){ runApp( new MyHome()); } class MyHome extends StatelessWidget{ @override Widget

Flutter TextFormField hidden by keyboard

二次信任 提交于 2019-12-09 04:48:36
问题 NOTE: Im using Navigator.of(context).push to push ModalRoute, Hi I have page with ModalRoute with TextFormField in the body, but when keyboard show up, the input is being hide by keyboard, how to fix this? return Container( child: ListView( children: <Widget>[ //other widget SizedBox(height: _qtyAnimation.value), Row( children: <Widget>[ Expanded( child: Text( "Jumlah", style: TextStyle(fontWeight: FontWeight.bold), ), ), SizedBox( width: 145.0, child: TextFormField( focusNode: _qtyFocusNode,

Alert Dialog with Rounded corners in flutter

不羁岁月 提交于 2019-12-08 23:16:35
问题 I am trying to create an alert dialog with rounded corners in Flutter same as below screenshot. also add my code here, but my output is exactly different from the expected one. anyone, please help me. Expected Alert Dialog my code is here. void _showAlert() { AlertDialog dialog = new AlertDialog( content: new Container( width: 260.0, height: 230.0, decoration: new BoxDecoration( shape: BoxShape.rectangle, color: const Color(0xFFFFFF), borderRadius: new BorderRadius.all(new Radius.circular(32

Flutter: How do I navigate to a new screen using DropDownMenuItems

喜夏-厌秋 提交于 2019-12-08 11:56:01
问题 I want to be able to navigate to a new screen when I choose MEN and another screen when I choose WOMEN. I've tried and did not seem to have any luck. There seems to be nothing on this on the web. Please how d I do this? Here is my code: return Scaffold( appBar: AppBar( title: DropdownButtonHideUnderline( child: new DropdownButton( value: null, //Have no idea what to put here items: <DropdownMenuItem>[ new DropdownMenuItem( child: new Text('MEN', style: style), ), new DropdownMenuItem( child: