My everyday Flutter practice demos with Dart.
Date: 2018-8-18
Tips:
- Try the MVC framework in Flutter with Dart(Bad practice, I think.)
- Use the
ClipRectandTransformto build a simple 3D-like animation widget, and withOffstage,RichTextect - Test custom gestures in Flutter
Date: 2018-7-21
The BUGS in the project not fixed till now...
Tips:
- Use
Flamelibrary in Flutter for game development - With
Sprite,Animation,Texture, andCollisioninBox2Dcomponents - Other stuffs: keep screen on, music play, device orientation and ect
PS: The game is failed for some reasons, include my development knowledge and the mature of the game framework, even thought, you can have a try!
Date: 2018-7-12
Tips:
- Basic unit test in Flutter:
group,testandexpect - Mock object test in Flutter with
mockitolibrary:Mock,verify,whenand matchers - Flutter Widget test with
flutter_testpackage:testWidgets,pumpWidgetandfind - Try the simplest
Flutter Drivertest and output result in Flutter
PS: Use driver test must follow this command in Terminal, no shortcut in IDEA:
# open simulator before running the test
flutter drive --target=./test_driver/integration_widget.dart
# not this file: integration_widget_test.dartDate: 2018-7-9
Tips:
- Search text in Database with
filtersanddistinctuseRxDartlibrary - Select images with
ImagePickerlibrary and decode image withImagelibrary - Edit mode in text filed in forms
- I tried Flutter Widget Test in my project, it is sweet! :)
PS: The Image library works incorrectly and cannot compress my images, why?
Date: 2018-6-27
Tips:
- Navigate to another page, and get the result value while the page pops, use
Futureand fluro - Change the data class to more helper one, with the help of
Mapin Flutter - Use
cryptopackage to encrypt password to secure strings and save to database
PS: When I compile my app, an error encountered as below:
compiler message: lib/pages/page_home.dart:71:59: Error: A value of type '#lib1::User' can't be assigned to a variable of type '#lib2::User'.
compiler message: Try changing the type of the left hand side, or casting the right hand side to '#lib2::User'.
Finished with error: FormatException: Bad UTF-8 encoding 0x3f (at offset 306)And at last I figured it out, in my imports:
//before:
import 'package:project_login_with_database/widgets/widget_login.dart';
import 'package:project_login_with_database/widgets/widget_register.dart';
import '../navigation.dart';
import '../widgets/widget_loader.dart';
//...
//after:
import '../widgets/widget_login.dart';
import '../widgets/widget_register.dart';
import '../navigation.dart';
import '../widgets/widget_loader.dart';
//...Date: 2018-6-17
Tips:
- Use Shared Preferences with
shared_preferencespackage, SQLite database withsqflite, and files withpath_provider - Simple
factoryconstructor in dart class, CURD operations with database, read and save data with shared preferences - Try the Terminal with
adb shellcommands:su root,sqlite3ect
PS: use this command for root permissions in Flutter terminal: su root
Date: 2018-6-7
Tips:
- Sliver widgets and parts in
CustomScrollView:BouncingScrollPhysics,SliverAppBar,SliverListandSliverGrid - Use
ScrollControllerin scroll view to control the appearance of app bar - Actions in app bar, use popup menus, and displays colors with shader
Date: 2018-6-2
Tips:
- Basic Firebase platform in Flutter, fetch data and save data via transition with
cloud_firestoredependency ValueKeyto identify list tiles, and build widget withStreamBuilder
PS: this app cannot work correctly in China for the blocking-network of Google service.
Date: 2018-5-31
Tips:
- Use
AnimatedIconinIconButtonwith animation controller to build animated icon - Build animated widget with
FadeTransition,PositionedTransitionandReverseAnimation
Still don't understand the value of top, bottom in RelativeRect.fromLTRB, while work with RelativeRectTween, though it behaviors all right.
Date: 2018-5-25
Tips:
- Try a lot of new widgets:
OutlineButton,SafeArea,SingleChildScrollView,AnimatedIcon,PositionedTransition,IconButton - Build rich text controls with
Form,TextFormField, andInputDecorationwithUnderlineInputBorder,OutlineInputBorder - Make simple Backdrop widget with
Stackand animations, build tabs with customShapeDecorationindicators
Resource: Flutter gallery
Date: 2018-5-21
Tips:
- Create a reveal transition widget with
CustomPainter,CustomPaint, get screen size withMediaQuery - Override
deactivatemethod to reset the state of widget - Use fluro package to navigate pages in Flutter
Resource: fluro
Date: 2018-5-17
Tips:
- Build a stop watch in Dart with
StopWatch, start, stop, and record - Use
Timerto trigger rendering in Flutter
Date: 2018-5-11
Tips:
- Build tab bar views in another Main Tab Bar with separated
TabController - Add change listener to tab controller to switch tab content
Date: 2018-5-10
Tips:
- Use
DrawerandUserAccountsDrawerHeader,ListTileto make material component drawer - Exit app with simple dialog and the function
exit(0)from librarydart:io - Now the code is fully switched to Dart 2.0
Date: 2018-5-8
Tips:
- Use
PhysicalModeland other base components to make new widget - Set width of widget to
double.infinityand get the real measurement with context - Make animated progress indicator with
CircularProgressIndicatorandAlwaysStoppedAnimation<Color>
Resource: Flutter Progress Button Animation
Date: 2018-5-2
Tips:
- Use
Canvasin custom painter in Flutter - Use
Offset,Paintand other graphics method to draw the component - Animations in drawing canvas with
AnimationController
Date: 2018-4-26
Tips:
- Import library, set the name to avoid the conflict for the same class name
- Use charts library in Flutter to build bar and pie chart
Resource: charts gallery and code
Date: 2018-4-25
Tips:
- The
ExpandedinColumnis used to restrain the width of the child - Use image assets in Flutter, which are specified in the pubspec.yaml file
Date: 2018-4-24
Tips:
- Navigator from home page to other pages with
NavigatorandMaterialPageRoute - Show dialog and get the response value of dialog in Flutter with
SimpleDialogandSimpleDialogOption - Notice: You cannot directly change the state of controls in dialog, so I create a new class extends
StatefulWidgetas the dialog state widget
Resource: Flutter - Radio Animation is not showing up on showDialog Document that showDialog creates now context and that setState on the calling widget therefore won't affect the dialog
Date: 2018-3-24
Tips:
- Use
FlexibleandExpanded,SizeTransitionto build the layout and animations - Use
TextFieldandTextEditingControllerto deal with text inputs - Divider, array list, default parameter in Flutter with Dart
Resource: https://codelabs.developers.google.com/codelabs/flutter/
Date: 2018-3-19
Tips:
- Use
AnimationControllerandCurvedAnimation,Tweento start animations in Flutter - Manually do animation with
addListenerand auto animate widgets withaddStatusListener - The widget
Opacityused to control the appearance of child widget
Date: 2018-3-16
Tips:
- Use
ListView.builderto build list view item with specified index - Set
NetworkImageasbackgroundImageofCircleAvatarto display circular images - Load data from network, and parse response content to json data
Date: 2018-3-15
Tips:
- Import
dart:mathlibrary to useRandomfunction - Basic
ListViewwith the list ofListTileas children, and set controller:ScrollController - Create
StatefulWidgetto response widget actions, and useGlobalKeyto show/hideSnackBar
Date: 2018-3-12
Tips:
- Use
DefaultTabControlleras root withTabBarin the bottom ofAppBarandTabBarViewto build tabbed view - Map the data list to get the widget list for the children of container
- Simple class in Dart with
finalproperties
Date: 2018-3-9
Tips:
- Many buttons, use Icons, styles,
Flutter Logo, and so on - Some layouts, menus, drop down items, and test the simple gesture detectors
- Text field, trigger the simple dialog, alert dialog and so on
Date: 2018-3-8
Tips:
- Basic material app themed with
ThemeDatause built-inMaterialAppwidget - Use
CenterandPadding,Columnto build layout - Add
MaterialButtoncontrol, setonPressedto change the state of widgets























