flutter-animation

How to access query from itemBuilder?

江枫思渺然 提交于 2020-01-06 08:33:20
问题 I am make random chat app use FirestoreAnimatedList (FirebaseAnimatedList for Firestore). I want show user avatar only one time if same user send many message so not have same avatar show many time. My solution is use index for check if last message send by same user. So I need check like : if (snapshot[index - 1][‘user’] == user) { return true; } But my snapshot is DocumentSnapshot so cannot call [index - 1] . Maybe I must get list from query ? How to access so can call index on list and

I want to change the color of CustomListTile which is child of ListView when onTap is clicked, and setting other children color into default one?

拥有回忆 提交于 2020-01-05 08:28:19
问题 In a Drawer, in listview want to change the color of CustomListTile when the onTap is clicked and setting color of all other children to default? class CustomListTile extends StatelessWidget { final Color itemContainerColor; const CustomListTile({ //deafult color is Colors.white this.itemContainerColor= Colors.white, }); @override Widget build(BuildContext context) { return InkWell( onTap: (){}, child: Container( margin: EdgeInsets.symmetric(vertical: 4), padding: EdgeInsets.symmetric

How can I disable the animation when you scroll all the way to the top in ListView.builder

╄→尐↘猪︶ㄣ 提交于 2020-01-04 06:50:43
问题 I'm trying to make a list on my flutter app. But, Every time I scroll all the way to the top there is this animation showing up like this: https://i.stack.imgur.com/Z7mHh.jpg, https://i.stack.imgur.com/EAIyj.jpg Is there a way to hide this animation? 回答1: NotificationListener<OverscrollIndicatorNotification>( onNotification: (OverscrollIndicatorNotification overscroll) { overscroll.disallowGlow(); }, child: ListView.builder(...)); As official docs say GlowingOverscrollIndicator generates

How to create a range slider with thumb as png image in flutter

半世苍凉 提交于 2020-01-01 01:14:15
问题 How to create smiley range slider in flutter. Like below GIF image. Discrete with Custom Theme I try to change thumb shape. But I want to change thumb as image. // Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import 'dart:math' as math; import 'package:flutter/material.dart'; class SliderDemo extends StatefulWidget { static const String routeName = '/material/slider'; @override

Flutter Transition Exit

余生颓废 提交于 2019-12-28 06:55:25
问题 On Android API we can use overridePendingTransition(int enterAnim, int exitAnim) to define the enter and exit transitions. How to do it in Flutter? I have implemented this code class SlideLeftRoute extends PageRouteBuilder { final Widget enterWidget; SlideLeftRoute({this.enterWidget}) : super( pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) { return enterWidget; }, transitionsBuilder: (BuildContext context, Animation<double> animation,

Flutter Transition Exit

北战南征 提交于 2019-12-28 06:54:09
问题 On Android API we can use overridePendingTransition(int enterAnim, int exitAnim) to define the enter and exit transitions. How to do it in Flutter? I have implemented this code class SlideLeftRoute extends PageRouteBuilder { final Widget enterWidget; SlideLeftRoute({this.enterWidget}) : super( pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) { return enterWidget; }, transitionsBuilder: (BuildContext context, Animation<double> animation,

Flutter implementing repeat Elastic animation

橙三吉。 提交于 2019-12-24 00:39:24
问题 for implementing this animation i wrote this below code but, Elastic animation doesn't work on project and i'm not sure whats problem, i want to have repeat of this animation import 'package:flutter/material.dart'; void main()=>runApp(MaterialApp(home: Avatar(),)); class Avatar extends StatefulWidget { @override State<StatefulWidget> createState()=>_Avatar(); } class _Avatar extends State<Avatar> with TickerProviderStateMixin{ AnimationController avatarController; Animation<double> avatarSize

Error when I try to show a SnackBar in a builder

一曲冷凌霜 提交于 2019-12-23 18:53:06
问题 This is my main.dart : class MyApp extends StatelessWidget { var login = new Login("xxxxxxx", "xxxxxxxxx"); final scaffoldKey = new GlobalKey<ScaffoldState>(); @override Widget build(BuildContext context) { return MaterialApp( title: 'Fetch Data Example', theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( key: scaffoldKey, appBar: AppBar( title: Text('Fetch Data Example'), ), body: Center( child: FutureBuilder( future: login.main(), builder: (context, snapshot) { if (snapshot

Animation is slow in flutter

女生的网名这么多〃 提交于 2019-12-22 18:39:09
问题 I am animating line in canvas in flutter.i am using AnimationController to control the animation. When i animate a single line, it is get animated without any lag or performance issue.But when i animate more than 10 lines it gets struck and lagging when rendering the line.In each frame redraw is getting called in order to animate the line .How to overcome this issue. Code Snippet class CrossPainter extends CustomPainter { Paint _paint; double _fraction; CrossPainter(this._fraction) { _paint =

Render Flutter animation directly to video

余生长醉 提交于 2019-12-22 09:48:02
问题 Considering that Flutter uses its own graphics engine, is there a way to render Flutter animations directly to video, or create screenshots in a frame by frame fashion? One use case would be that this allows easier demonstration for the audience. For example, an author wants to create a Flutter animation tutorial, where they builds a demo app and writes a companion blog post, using the animation GIF/videos rendered directly with Flutter. Another example would be one developer outside the UI