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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,4 @@ How on this earth did I not know about this widget earlier? This is going to sav
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
Binary file added assets/92_autocomplete_textfield.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/93connectivity.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/95defaulttextstyle.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/97linkify.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/98spinkit.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions week02.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,4 @@ FractionallySizedBox is build exactly for that use case. Just give it the fracti
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week03.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@ But From dart 2.3 and above, we can use Spread Operator (`...`) to add collectio
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week04.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,4 @@ The following animation is done with just `AnimatedContainer()`
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week05.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,4 @@ _Dev tools page_
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week06.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,4 @@ We can use ShapeBorder to give outline to widgets or Clip them on it's shape. Th
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week07.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,4 @@ ___`Widget/Image()`___ -Inside-> ___`ClipRRect()`___ -Inside-> ___`Container()`_
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week08.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ From dart 2.8 onwards, the command `pub outdated` gives you the overview of your
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week09.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@ Image.network | CachedNetworkImage
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week10.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,4 @@ Just give the animation `duration` & the updated `TextStyle`. `AnimatedDefaultTe

[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week11.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ Do you want pause program flow for a certain duration? You can use `Future.delay
[__`Next >>`__](week12.md)

[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)
2 changes: 2 additions & 0 deletions week12.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,5 @@ Alice records Http request,payload & response which can be viewed in simple UI (
[__`<< Previous`__](week11.md)
[___`Tips 78-84`___](week12.md)
[__`Next >>`__](week13.md)

[__`Tips 92-98`__](week14.md)
1 change: 1 addition & 0 deletions week13.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,4 @@ PressableDough(

[__`<< Previous`__](week12.md)
[___`Tips 85-91`___](week13.md)
[__`Next >>`__](week14.md)
232 changes: 232 additions & 0 deletions week14.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
---
title: Flutter Tips 85-91
date: '2020-07-12'
spoiler: 14th batch of 7 tips and tricks on the series 100DaysOfFlutter.
---

## #92 Autocomplete TextField with `flutter_typeahead`

Autocomplete TextField can be implemented with `flutter_typeahead` Package.

1. Add Dependency

```yml
dependencies:
flutter_typeahead: ^version
```

2. Use `TypeAheadFormField` / `TypeAheadField`

```dart
var platforms = ["Flutter", "Android", "iOS", "Mac", "React", "Cordova"];
final TextEditingController input = TextEditingController();

TypeAheadFormField(
textFieldConfiguration: TextFieldConfiguration(
decoration: InputDecoration(labelText: 'City'),
controller: this.input),

//Search and return found values
suggestionsCallback: (pattern) => platforms.where(
(item) => item.toLowerCase().contains(pattern.toLowerCase()),
),
itemBuilder: (_, item) => ListTile(title: Text(item)),
onSuggestionSelected: (query) => this.input.text = query,
),
```

[visit flutter_typeahead](https://pub.dev/packages/flutter_typeahead)

[visit demo](https://gist.github.com/erluxman/523818577fa54cb6d0f5e0e8cc1d6a9a)

![autocomplete](assets/92_autocomplete_textfield.gif)

## #Day93 Read Network State with `connectivity` package

`connectivity` package makes it easy to read network state of device.

1. Add dependency

```yml
dependencies:
connectivity: ^version
```

2. Read network states

```dart
class State ...{
@override
initState() {
super.initState();
subscription = Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult result) {
if (result == ConnectivityResult.mobile) //mobile connected.
else if (result == ConnectivityResult.wifi) //Wifi Connected.
else if(result == ConnectivityResult.none) //No network
});
}

@override
dispose() {
subscription.cancel();
super.dispose();
}
}
```

[visit connectivity package](https://pub.dev/packages/connectivity)

[visit sample gist](https://gist.github.com/erluxman/7e47f12378e79e0168cca7b6eea1c416)

![](assets/93connectivity.gif)

## #94 ⚡️ `superCharged`⚡️

`supercharged` brings awesome utility features from other languages to dart 🎯. making developers life easier.
### 1. Add Dependency

```yml
dependencies:
supercharged: ^1.6.0
```

### 2. Have fun 🎉

```dart
"#ff00ff".toColor();
"red".toColor();
"flutter is cool".allBefore(" is"); // "flutter"
12.between(0, 30); // true
[1, 2, 3].elementAtOrNull(4); // Don't throw, return null
[1, 2, 3].elementAtOrElse(4, () => 0); //Don't throw, return default value
//Create Pages from list
["a", "b", "c"].chunked(2, fill: () => ""); // [ ["a", "b"], ["c", ""] ]

var duration = 5.minutes + 30.seconds;
duration += 0.5.hours

100.0.tweenTo(200.0); // Tween(begin: 100.0, end: 200.0)
Colors.red.tweenTo(Colors.blue); // ColorTween(...)

//Easy for loop
["dog", "cat"].forEachIndexed((index, value) {
print("$i : $value") // 1 : dog, 2 : cat
});
```

[visit supercharged](https://pub.dev/packages/supercharged)

## #95 DefaultTextStyle Widget

We can apply TextStyle to all the widgets in the hirarchy by wrapping it with DefaultTextStyle.

```dart
DefaultTextStyle(
child: Column(
children: <Widget>[
Text(
"DefaultTextStyle With Green text color",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20, color: Colors.black),
),
Text("Title"), //Green color, size 30
Text("SubTitle", style: TextStyle(fontSize: 25)), //Green color, size 25
Text("Heading", style: TextStyle(fontSize: 20)), //Green color, size 20
],
),
style: TextStyle(fontSize: 30, color: Colors.green),
);
```

[visit sample](https://codepen.io/erluxman/pen/wvMXJKK)

![defaulttextstyle](assets/95defaulttextstyle.png)

## #96 `flutter_cache_manager`

You can use `flutter_cache_manager` to Download **`and / or`** Cache files.

```dart
//Get file from Cache and download if not cached already.
File file = await DefaultCacheManager().getSingleFile(url);

//Download File without caching
File file = await DefaultCacheManager().downloadFile(url);
```

[visit on pub.dev](https://pub.dev/packages/flutter_cache_manager#-readme-tab-)

## #97 Make link on Text clickable using `flutter_linkify`

`flutter_linkify` is a Text Widget that automatically finds the URL link in the string and makes it clickable.

1. Add dependency

```yml
dependencies:
flutter_linkify: ^version
```

2. Enjoy

```dart
Linkify(
text: "My twitter https://twitter.com/erluxman",
onOpen: (LinkableElement url) {
Scaffold.of(context).showSnackBar(
SnackBar(content: Text("${url.text} clicked")),
);
},
)
```

![linkify](assets/97linkify.gif)
[visit pacakge](https://pub.dev/packages/flutter_linkify#-installing-tab-)

### #98 Package `flutter_spinkit`

We need to show **`loading/progress`** in almost every apps, but `CircularProgressBar` everywhere is boring.

`flutter_spinkit` provides many awesome Progress indictors that we can use.

1. Add dependency

```yml
flutter_spinkit: ^4.1.2+1
```

1. Start Using
- #### 🔥Type `SpinKit` and press `Ctrl+SPACE` to see all possible indicators.
- Give `color (@required)`, `size(optional)` and `duration(optional)` to SpinKit* widgets.

```yml
SpinKitCircle(size: 90, color: Colors.cyan),
SpinKitChasingDots(size: 190, color: Colors.blue),
SpinKitCubeGrid(size: 90, color: Colors.blue),
SpinKitDualRing(size: 90, color: Colors.blue,),
SpinKitFadingCube(size: 90, color: Colors.red),
SpinKitFadingFour(size: 90, color: Colors.green)
```

[visit flutter_spinkit](https://pub.dev/packages/flutter_spinkit#-readme-tab-)

![spinkit](assets/98spinkit.gif)

[___`Tips 1-7`___](README.md)
[__`Tips 08-14`__](week02.md)
[__`Tips 15-21`__](week03.md)
[__`Tips 22-28`__](week04.md)
[__`Tips 29-35`__](week05.md)
[__`Tips 36-42`__](week06.md)
[__`Tips 43-49`__](week07.md)
[__`Tips 50-56`__](week08.md)
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 75-91`__](week13.md)

[__`<< Previous`__](week13.md)
[___`Tips 82-98`___](week14.md)