dart

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

坚强是说给别人听的谎言 提交于 2021-02-07 06:13:59
问题 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

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

。_饼干妹妹 提交于 2021-02-07 06:13:33
问题 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

Flutter: Implementing a peek & pop effect

旧城冷巷雨未停 提交于 2021-02-07 04:18:54
问题 I was trying to achieve a peek & pop effect - when the user taps and hold on to a card, a dialog opens, and dismissed when the user no longer tap holding on the screen: Listener( onPointerDown: (PointerDownEvent e) { // open dialog showDialog( context: context, builder: (context) => Container( child: Card(), )); }, onPointerUp: (PointerUpEvent e) { // dismiss dialog if (Navigator.of(context).canPop()) { Navigator.of(context).pop('dialog'); } }, child: Card() ) It worked nicely which shows the

Flutter: Implementing a peek & pop effect

前提是你 提交于 2021-02-07 04:18:45
问题 I was trying to achieve a peek & pop effect - when the user taps and hold on to a card, a dialog opens, and dismissed when the user no longer tap holding on the screen: Listener( onPointerDown: (PointerDownEvent e) { // open dialog showDialog( context: context, builder: (context) => Container( child: Card(), )); }, onPointerUp: (PointerUpEvent e) { // dismiss dialog if (Navigator.of(context).canPop()) { Navigator.of(context).pop('dialog'); } }, child: Card() ) It worked nicely which shows the

Flutter: Implementing a peek & pop effect

会有一股神秘感。 提交于 2021-02-07 04:18:08
问题 I was trying to achieve a peek & pop effect - when the user taps and hold on to a card, a dialog opens, and dismissed when the user no longer tap holding on the screen: Listener( onPointerDown: (PointerDownEvent e) { // open dialog showDialog( context: context, builder: (context) => Container( child: Card(), )); }, onPointerUp: (PointerUpEvent e) { // dismiss dialog if (Navigator.of(context).canPop()) { Navigator.of(context).pop('dialog'); } }, child: Card() ) It worked nicely which shows the

How to pass widget constructor as a parameter for another widget to build

梦想的初衷 提交于 2021-02-07 03:13:10
问题 Is there a way to pass one widget as a parameter to another? My code has something similar to this with two TextWidget of type BoldWidget and ItalicWidget : abstract class TextWidget extends StatelessWidget { final String text; TextWidget({ @required this.text, }); } class BoldWidget extends TextWidget { @override Widget build(BuildContext context) { return Text(this.text, style: TextStyle(fontWeight: FontWeight.bold),); } } class ItalicWidget extends TextWidget { @override Widget build

Video background in flutter

旧巷老猫 提交于 2021-02-07 02:48:29
问题 It is possible to have a background video playing all time in flutter? i was looking for some packages and trying to make it function but i dont know how. maybe using something like this but with video. decoration: new BoxDecoration( image: new DecorationImage( image: new AssetImage("images/f1.jpg"), fit: BoxFit.cover, ),), inside a container. 回答1: Try this package https://pub.dartlang.org/packages/video_player the example provided is pretty straight forward to follow. You can then just place

flutter doctor --android-licenses gives a java error

强颜欢笑 提交于 2021-02-06 14:46:29
问题 Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75) at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73) at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli

flutter使用provider简单实现计数器

走远了吗. 提交于 2021-02-06 14:31:37
1,首先在pubspec.yaml里面安装 2,在同一个页面创建两个widget(或者将这两个widget单独创立dart文件) import 'package:flutter/material.dart'; import 'dart:async'; import 'package:provider/provider.dart'; import '../../provide/cunter.dart'; class StrictsSelection extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Column( children: [ Number(), MyButton() ], ), ), ); } } class Number extends StatelessWidget { @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.only(top: 200), child: Text("${Provider.of<Counter>(context).value}"), ); } } class

Navigator routes Clear the stack of flutter

烈酒焚心 提交于 2021-02-06 14:20:37
问题 In my app i have three screens login , verifyotp , generatepass. I know how to move from one page to other page eg: Navigator.pushNamed(context, "/theNameOfThePage"); . I have a flow in which i move from login->verifyotp->generatepass my question is now how can i move from generatepass to login page and clearing all the stack. I am an android developer so in android we have intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); . How can i achieve same result in