From 0f183f8766ffec4cec32bf153370600d01e34a09 Mon Sep 17 00:00:00 2001 From: Luis Ciber Date: Mon, 25 Oct 2021 00:30:29 -0400 Subject: [PATCH] Improve UI animations --- lib/app/widgets/app_drawer.dart | 14 +++++++++----- lib/nauta/view/accounts_view.dart | 4 +++- lib/nauta/view/save_account_view.dart | 2 +- lib/settings/view/disclaimer_view.dart | 1 + lib/settings/view/settings_view.dart | 1 + lib/ussd_codes/view/ussd_category_view.dart | 11 ++++++++--- lib/ussd_codes/view/ussd_code_view.dart | 11 ++++++++--- lib/ussd_codes/widgets/ussd_code_form.dart | 1 + pubspec.lock | 7 +++++++ pubspec.yaml | 1 + 10 files changed, 40 insertions(+), 13 deletions(-) diff --git a/lib/app/widgets/app_drawer.dart b/lib/app/widgets/app_drawer.dart index b54edad..d7ea351 100644 --- a/lib/app/widgets/app_drawer.dart +++ b/lib/app/widgets/app_drawer.dart @@ -1,3 +1,4 @@ +import 'package:animate_do/animate_do.dart'; import 'package:flutter/material.dart'; import 'package:todo/app/app.dart'; // import 'package:todo/nauta/nauta.dart'; @@ -17,17 +18,20 @@ class AppDrawer extends StatelessWidget { child: Stack( children: [ ListView( + physics: const BouncingScrollPhysics(), children: [ DrawerHeader( child: Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ - Container( - margin: const EdgeInsets.all(10), - child: Assets.images.logo.image( - width: 75, - height: 75, + ZoomIn( + child: Container( + margin: const EdgeInsets.all(10), + child: Assets.images.logo.image( + width: 75, + height: 75, + ), ), ), Text( diff --git a/lib/nauta/view/accounts_view.dart b/lib/nauta/view/accounts_view.dart index aa8dcb9..1367135 100644 --- a/lib/nauta/view/accounts_view.dart +++ b/lib/nauta/view/accounts_view.dart @@ -1,3 +1,4 @@ +import 'package:animate_do/animate_do.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:todo/app/app.dart'; @@ -32,9 +33,10 @@ class AccountsView extends StatelessWidget { return Padding( padding: const EdgeInsets.all(8), child: ListView( + physics: const BouncingScrollPhysics(), children: [ ...state.accounts.map( - (e) => AccountTile(account: e), + (e) => FadeInUp(child: AccountTile(account: e)), ), ], ), diff --git a/lib/nauta/view/save_account_view.dart b/lib/nauta/view/save_account_view.dart index 85cac4b..c327374 100644 --- a/lib/nauta/view/save_account_view.dart +++ b/lib/nauta/view/save_account_view.dart @@ -22,7 +22,7 @@ class SaveAccountView extends StatelessWidget { AccountsPage.open(context); }, child: SingleChildScrollView( - physics: const ClampingScrollPhysics(), + physics: const BouncingScrollPhysics(), child: AutofillGroup( child: Padding( padding: const EdgeInsets.all(8), diff --git a/lib/settings/view/disclaimer_view.dart b/lib/settings/view/disclaimer_view.dart index 85dc899..ac9c958 100644 --- a/lib/settings/view/disclaimer_view.dart +++ b/lib/settings/view/disclaimer_view.dart @@ -20,6 +20,7 @@ class DisclaimerView extends StatelessWidget { title: AppBarTitle(l10n.termOfUse), ), body: ListView( + physics: const BouncingScrollPhysics(), children: [ const SizedBox( height: 20, diff --git a/lib/settings/view/settings_view.dart b/lib/settings/view/settings_view.dart index 0ecf608..aa29e13 100644 --- a/lib/settings/view/settings_view.dart +++ b/lib/settings/view/settings_view.dart @@ -26,6 +26,7 @@ class SettingsView extends StatelessWidget { return Padding( padding: const EdgeInsets.all(30), child: ListView( + physics: const BouncingScrollPhysics(), children: [ const SizedBox(height: 30), SettingsSwitch( diff --git a/lib/ussd_codes/view/ussd_category_view.dart b/lib/ussd_codes/view/ussd_category_view.dart index 62901e3..490a47a 100644 --- a/lib/ussd_codes/view/ussd_category_view.dart +++ b/lib/ussd_codes/view/ussd_category_view.dart @@ -1,3 +1,4 @@ +import 'package:animate_do/animate_do.dart'; import 'package:flutter/material.dart'; import 'package:todo/app/app.dart'; import 'package:todo/ussd_codes/ussd_codes.dart'; @@ -19,6 +20,7 @@ class UssdCategoryView extends StatelessWidget { title: AppBarTitle(category.name), ), body: ListView( + physics: const BouncingScrollPhysics(), children: [ const SizedBox( height: 15, @@ -37,9 +39,12 @@ class UssdCategoryView extends StatelessWidget { height: 15, ), ...category.items.map( - (e) => UssdItemWidget( - ussdItem: e, - recent: recent, + (e) => FadeInLeft( + duration: const Duration(milliseconds: 400), + child: UssdItemWidget( + ussdItem: e, + recent: recent, + ), ), ), const SizedBox( diff --git a/lib/ussd_codes/view/ussd_code_view.dart b/lib/ussd_codes/view/ussd_code_view.dart index 6d65932..a35ef20 100644 --- a/lib/ussd_codes/view/ussd_code_view.dart +++ b/lib/ussd_codes/view/ussd_code_view.dart @@ -1,3 +1,4 @@ +import 'package:animate_do/animate_do.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:todo/app/app.dart'; @@ -25,11 +26,15 @@ class UssdCodeView extends StatelessWidget { } return ListView( + physics: const BouncingScrollPhysics(), children: [ ...items.map( - (e) => UssdItemWidget( - ussdItem: e, - recent: recent, + (e) => FadeInLeft( + duration: const Duration(milliseconds: 400), + child: UssdItemWidget( + ussdItem: e, + recent: recent, + ), ), ) ], diff --git a/lib/ussd_codes/widgets/ussd_code_form.dart b/lib/ussd_codes/widgets/ussd_code_form.dart index 00ae8c8..84658ac 100644 --- a/lib/ussd_codes/widgets/ussd_code_form.dart +++ b/lib/ussd_codes/widgets/ussd_code_form.dart @@ -42,6 +42,7 @@ class _UssdCodeFormState extends State { return Form( key: _formKey, child: ListView( + physics: const BouncingScrollPhysics(), children: [ widget.icon, const SizedBox(height: 30), diff --git a/pubspec.lock b/pubspec.lock index 1d36344..6779b7c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -15,6 +15,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.2" + animate_do: + dependency: "direct main" + description: + name: animate_do + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" archive: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b3c79b1..fa2acdc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,6 +7,7 @@ environment: sdk: ">=2.12.0 <3.0.0" dependencies: + animate_do: ^2.0.0 beamer: ^0.14.1 bloc: ^7.2.0 connectivity_plus: ^2.0.2