Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
bbc1a61
Add missing title for day 22
triallax May 3, 2020
47463ff
Fix some typos
triallax May 3, 2020
baebb16
Merge branch 'master' into fix-typos
triallax May 3, 2020
1609f51
Merge pull request #5 from mhmdanas/fix-typos
erluxman May 4, 2020
fd00d19
Simplify title
triallax May 4, 2020
d915cbe
Merge remote-tracking branch 'upstream/master' into add-day22-title
triallax May 4, 2020
0faa284
Merge pull request #4 from mhmdanas/add-day22-title
erluxman May 4, 2020
59f455b
added week 5 tips
erluxman May 10, 2020
f88aef8
Merge pull request #6 from erluxman/week_5
erluxman May 10, 2020
a2123c8
added week 6 tips
erluxman May 18, 2020
05af181
Merge branch 'master' of github.com:erluxman/awesomefluttertips into …
erluxman May 18, 2020
364e051
Merge pull request #7 from erluxman/week_6
erluxman May 18, 2020
7dde8d1
added week 7 tips
erluxman May 25, 2020
e171d2f
Merge pull request #9 from erluxman/week_7
erluxman May 25, 2020
dcab2d0
added 7 more tips
erluxman May 31, 2020
a11f362
Merge pull request #10 from erluxman/week_8
erluxman May 31, 2020
ed30f17
completed week9
erluxman Jun 7, 2020
a7ddac6
added flare and SVG sample app demo
erluxman Jun 7, 2020
be55a1c
Merge pull request #11 from erluxman/week_9
erluxman Jun 7, 2020
73bd6ba
added comparing gifs sideby side
erluxman Jun 7, 2020
f1de6e5
Merge pull request #12 from erluxman/week_9
erluxman Jun 7, 2020
8e66c67
started modularizing the tips
erluxman Jun 7, 2020
330f0ba
making links more distinct
erluxman Jun 7, 2020
f9da5c5
changed style for current page
erluxman Jun 7, 2020
4e075b8
separating previous and next tips
erluxman Jun 7, 2020
e663287
separating previous and next tips second page
erluxman Jun 7, 2020
8348567
Fix formatting
erluxman Jun 7, 2020
75b550f
applied formatting to all pages
erluxman Jun 7, 2020
5e72e2d
Merge pull request #13 from erluxman/modularization
erluxman Jun 7, 2020
2c745d2
fixed lint issues
erluxman Jun 7, 2020
ec25ad5
fixed lint issues
erluxman Jun 7, 2020
37e11de
added partial week 10 updates
erluxman Jun 12, 2020
73918b4
Improve adding build badge tip
erluxman Jun 12, 2020
12dd146
added codecoverage tips
erluxman Jun 13, 2020
3423de5
added video link
erluxman Jun 13, 2020
4df8d81
updated video url
erluxman Jun 13, 2020
99a0aca
uploaded week 10 tips
erluxman Jun 14, 2020
40a2e40
Updated Page number
erluxman Jun 14, 2020
dcbe781
Added week 11 tips
erluxman Jun 21, 2020
36b25c7
Update README.md
erluxman Jun 24, 2020
0cea085
Update README.md
erluxman Jun 24, 2020
38e62e3
Added week 12 tips
erluxman Jun 29, 2020
4c50237
Merge branch 'master' of github.com:erluxman/awesomefluttertips
erluxman Jun 29, 2020
609cbb5
Update README.md
erluxman Jul 4, 2020
ab2c351
Added week 13
erluxman Jul 5, 2020
4b0511a
Merge pull request #15 from erluxman/week_13
erluxman Jul 5, 2020
b8c9fef
added week 14
erluxman Jul 12, 2020
4bf25ba
Merge pull request #16 from erluxman/week_14
erluxman Jul 12, 2020
43e2b5c
completed 100th items
erluxman Jul 13, 2020
73071bb
Merge branch 'master' of github.com:erluxman/awesomefluttertips
erluxman Jul 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
228 changes: 228 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,231 @@ The following animation is done with just `AnimatedContainer()`
[play with the animation in codepen](https://codepen.io/erluxman/pen/MWaEZEz)

![](assets/28animatedcontainer.gif)


## #Day29 Wrap widget

When you are making responsive UIs, you need to wrap contents dynamically.

Wrap comes to the rescue. Wrap is like Column/Row but wraps it's children to next row or column.

Use Wrap like you use Column or Row just give it's direction (either vertical or horizontal)

Wrap(
direction: Axis.vertical/Axis.horizontal,
children: [Widgets],
runAlignment: WrapAlignment.start,
spacing: 20, //space between previous and next item
runSpacing: 20, //space between new row or column
);
[try in codepen](https://codepen.io/erluxman/pen/YzyENpR)
![](assets/29wrap.gif)




## #Day30 Blur a Widget in Flutter

To blur a widget, put it below a BackdropFilter widget in stack.

1. Adjust Gussian blur level with sigmaX, and sigmaY.
2. Must provide child to Backdrop it needs a layer to act as blur.


Stack(
fit: StackFit.loose,
children: <Widget>[
FlutterLogo(size: 300),
Positioned.fill(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Container(
color: Colors.transparent,
),),
],
)


You will a blur like this.
[play in codepen](https://codepen.io/erluxman/pen/xxwPJrY)
![](assets/30blur.png)

## #Day31 Changing Theme Dynamically

Theme of the application is nothing but argument in MaterialApp or CupertinoApp.

Just create a StreamController of bool to represent it's theme.

With the use of StreamBuilder, set the theme of inside Material/Cupertino App and boom 🚀 your app will be able to change it's theme dynamically.

//Define a Inherited Widget
class SettingsStore extends InheritedWidget {
final ValueNotifier<ThemeData> theme = ValueNotifier(ThemeData.light());

SettingsStore({@required Widget child}) : super(child: child);

static SettingsStore of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<SettingsStore>();

void updateTheme(ThemeData theme) => this.theme.value = theme;

@override
bool updateShouldNotify(SettingsStore oldWidget) => oldWidget.theme != this.theme;
}


//Listen to it
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ValueListenableBuilder(
valueListenable: SettingsStore.of(context).theme,
builder: (context, theme, child) => MaterialApp(
theme: theme,
home: SettingsView(),),
);
}
}



//Change the theme from any build method.
SettingsStore.of(context).updateTheme(ThemeData.light())


Credit: [u/Kounex's](https://www.reddit.com/user/Kounex/)

[try on dartpad](https://dartpad.dartlang.org/ccac4c4dff07d69deb6fcacbdeebaa3c)


![](assets/32dynamictheme.gif)


## #Day32 Dart Extension

We can extend functionality to existing class/API/Library without inheriting it to a child class.

Extensions can have method, getter and setter.

Here we add function to DateTime class without subclassing it.

Define extension like this :

extension DateExtensions on DateTime{

printYYYYMMdd(String seperator) {
var dateString = "${this.year}$seperator${getTwoDigit(this.month)}$seperator${getTwoDigit(this.day)}";
print(dateString);
}

String getTwoDigit(int number){
return (number < 10)? "0$number" :number.toString();
}

DateTime get nextYear => this.add(Duration(days:365));

DateTime previousYear() => this.subtract(Duration(days:365));
}

Then Just Call those extensions

void main() {
var now = DateTime.now();
var nextYear = now.nextYear;
var lastYear = now.previousYear();

now.printYYYYMMdd("-");
nextYear.printYYYYMMdd("/");
previousYear.printYYYYMMdd(".");
}


[try on dartpad](https://dartpad.dartlang.org/45e30e5208b39123053f2408624d641c)


## #Day33 ToastBadge (toast_badge) package

If you want to show notification that auto dismisses anywhere in the screen, use `toast_badge`.

Just wrap any widget with `ToastBadget` or call `.enableBadge()` on any widget, you will be able to show notification on that widget without the need of BuildContext object.

i.e. You use it like toast but in the place you desire.

1. Wrap


child: ToastBadge( child: SettingPage(),),


//OR

child: SettingPage().enableBadge(),

2. Call


ToastBadge.show("Hello Toast");


//With more options

ToastBadge.show("Hello Toast",
mode: ToastMode.INFO,
duration: Duration(milliseconds: 500));


[use this package](https://github.com/erluxman/toast_badge)

![](assets/33toastbadge.gif)


## #Day34 Making Reorderable list.

Create ReorderableListView just like normal ListView.

1. Give Key to each child
2. Handle onReorder: (oldIndex, newIndex)


ReorderableListView(
onReorder: (oldIndex, newIndex) {
setState(() {
if (oldIndex < newIndex) {
newIndex -= 1;
}
var previous = names.removeAt(oldIndex);
names.insert(newIndex, previous);
});
},
children:[
child(key:ObjectKey(item)),.....
]
)

[try in codepen](https://codepen.io/erluxman/pen/Yzyabpz)

![](assets/34reorderable.gif)


## #Day35 Dart Dev tools

Dart dev tool is powerful set of debugging and performance tools like Layout Inspector,Timeline, Memory, App Performance,Debugger,Logging & Network monitor.

Android Stidio : You can open it by clicking dart icon on Run tab when app is runnin in Anadroid Studio

VSCode: typing Open Dev Tools in command Pallet.

Learining to use Dart Dev tool is very 🚨important skill🚨 to have as a Flutter/dart developer.

![Opening in Android Studio](assets/35as.png)
_Opening in Android Stuido_


![](assets/35vscode.png)
_Opening in VSCode_


![](assets/35devtools.png)
_Dev tools page_

[See amazing dart dev tool gifs](https://www.google.com/search?q=dart+devtools+gif&tbm=isch&rlz=1C5CHFA_enNP896NP896&hl=en&ved=2ahUKEwjG5J75pqjpAhW8A7cAHTFmCdYQBXoECAEQKA&biw=1920&bih=1066)
Binary file added assets/29wrap.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/30blur.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/32dynamictheme.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/33toastbadge.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/34reorderable.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/35as.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/35devtools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/35vscode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.