Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added week 12 tips
  • Loading branch information
erluxman committed Jun 29, 2020
commit 38e62e31d95cd537a10649f1529a878e2790f828
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ How on this earth did I not know about this widget earlier? This is going to sav
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
Binary file added assets/79assets.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/81quicktype.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/82pdf_flutter.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/84inspector.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 @@ -136,3 +136,4 @@ FractionallySizedBox is build exactly for that use case. Just give it the fracti
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
1 change: 1 addition & 0 deletions week03.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@ But From dart 2.3 and above, we can use Spread Operator (`...`) to add collectio
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
2 changes: 1 addition & 1 deletion week04.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ The following animation is done with just `AnimatedContainer()`
[__`Tips 50-56`__](week08.md)
[__`Tips 57-63`__](week09.md)
[__`Tips 71-77`__](week11.md)

[__`Tips 78-84`__](week12.md)
1 change: 1 addition & 0 deletions week05.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,4 @@ _Dev tools page_
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
1 change: 1 addition & 0 deletions week06.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,4 @@ We can use ShapeBorder to give outline to widgets or Clip them on it's shape. Th
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
1 change: 1 addition & 0 deletions week07.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,4 @@ ___`Widget/Image()`___ -Inside-> ___`ClipRRect()`___ -Inside-> ___`Container()`_
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
1 change: 1 addition & 0 deletions week08.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ From dart 2.8 onwards, the command `pub outdated` gives you the overview of your
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
1 change: 1 addition & 0 deletions week09.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ Image.network | CachedNetworkImage
[__`Next >>`__](week10.md)

[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
2 changes: 2 additions & 0 deletions week10.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,5 @@ Just give the animation `duration` & the updated `TextStyle`. `AnimatedDefaultTe
[__`<< Previous`__](week09.md)
[___`Tips 64-70`___](week10.md)
[__`Next >>`__](week11.md)
[__`Tips 78-84`__](week12.md)

1 change: 1 addition & 0 deletions week11.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ Do you want pause program flow for a certain duration? You can use `Future.delay

[__`<< Previous`__](week10.md)
[___`Tips 71-77`___](week11.md)
[__`Next >>`__](week12.md)
199 changes: 199 additions & 0 deletions week12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# Tips 78-84

## Day 78 Easy navigation

Have you been navigating to different screen like this?

❌ Dont do this anymore ❌

Navigator.of(this).push(
MaterialPageRoute(builder: (context) => NextScreen()),
);


✅ Do this ✅

1. Define a simple extension on `BuildContext`.

extension NavigationExtension on BuildContext {

navigateTo(Widget destination) {
Navigator.of(this).push(
MaterialPageRoute(builder: (context) => destination),
);
}
}
2. 🎉 Celebrate 🎉 🎉

context.navigateTo( NextScreen());
context.navigateTo( SeventhScreen());
context.navigateTo( SettingPage());

## #Day 79 Just import every folders inside assets rather than every files

**It's too much of work 😰🥱 to import every assets like image 🏞, json , audio 🎵into `pubspec.yml`**

**But sadly 😢, you can't import just the `assets` folder.**

**Just import all the folders, it will work 🎉🍾.**

![import](assets/79assets.png)

## #Day 80 Make a class of Resources like R.string, R.svg,R.images, R.flare etc instead of direct asset path

Instead of using raw string, path & URLs, we can organize them in Resource classes.

__`Group constants, paths and strings by their types`__

class Strings {
String appName = "Productive";
String privacyURL = "https://blabla.com";
}
class SVGImages { String homeIcon = "assets/images/home.svg";}
class LottieFiles { String paperPlane = "assets/lottie/paper_plane.json";}

__`Organize all resource into one class`__

class R {
static Strings strings = Strings();
static SVGImages svgImages = SVGImages();
static LottieFiles lottieFiles = LottieFiles();
}

__`Use resources instead of raw strings and path`__

// ❌ Don't use raw Strings & Paths ❌
Text("Productive"),
Image.asset("assets/images/home.svg"),
Lottie.asset("assets/lottie/paper_plane.json"),

// ✅ Acess String & Pathsfrom Resource ✅
Text(R.strings.appName),
Image.asset(R.svgImages.homeIcon),
Lottie.asset(R.lottieFiles.paperPlane),

## #Day81 use [https://app.quicktype.io/](https://app.quicktype.io/) to generate serializer/deserializer for dart

Convert a `JSON` into `Dart class` with `fromJSON()` and `toJSON()` methods easily with [quicktype.io](http://quicktype.io)

Just **paste your JSON** and select `dart` from languages (right-top), you will get the `dart class`.

try quicktype

[app.quicktype.io](app.quicktype.io)

Alternative:

Or [json to dart](https://javiercbk.github.io/json_to_dart/)

![quicktype](assets/81quicktype.gif)

## #Day82 Loading PDF

You can display PDF easily with `pdf_flutter`

1. Add `pdf_flutter` on pubspec.yml

dependencies:
pdf_flutter: ^version

2. On `iOS` enable **PDF preview** like by adding this on ios/Runner/info.plist:

<key>io.flutter.embedded_views_preview</key>
<true/>
3. Start Using

//Load PDF from Network
PDF.network(
'https://raw.githubusercontent.com/FlutterInThai/Dart-for-Flutter-Sheet-cheet/master/Dart-for-Flutter-Cheat-Sheet.pdf',
height: 500,
width: 300,)

//Load PDF from Assets
PDF.assets("assets/pdf/demo.pdf",height:400,width:300)

//Load PDF from file
File fileName;
PDF.file(fileName,height:400,width:300)

Visit [pdf_flutter](https://github.com/erluxman/pdf_flutter)

![pdf_flutter](assets/82pdf_flutter.gif)

## #Day83 `flutter clean`

An obvious but underappreciated tip:

More than half of the unexpected/strange build errors can be solved by `flutter clean`

The first step towards fixing any build errors in Flutter should be:

flutter clean

__`🤡Remember this command, it will save you hours of frustration`__

## #Day 84 Use `Alice` plugin to inspect network requests like chuck

Alice records Http request,payload & response which can be viewed in simple UI (notification or widget). Alice can work with http:http, dart:io/HttpClient, Chopper & Dio.

### Steps

1. Add dependency.
2. Create Alice instance (global is OK)

Alice _alice = Alice(showNotification: true, showInspectorOnShake: true);

3. Pass `_alice.getNavigatorKey()` as NavigatorKey of Material/Cupertino App.

MaterialApp(
navigatorKey: _alice.getNavigatorKey(),
child:....
)

4. Start logging (using http:http for sample)

import 'package:http/http.dart' as http;

http
.post('https://jsonplaceholder.typicode.com/posts', body: body)
.interceptWithAlice(_alice, body: body);

http
.get('https://jsonplaceholder.typicode.com/posts')
.interceptWithAlice(_alice);

http
.put('https://jsonplaceholder.typicode.com/posts/1', body: body)
.then((response) {
_alice.onHttpResponse(response, body: body);
});

5. See the HTTP call details
Simply call `_alice.showInspector();`

**or**

`Just shake the phone`

**to**

open the **Http call details** screen.

[get alice](https://pub.dev/packages/alice)

![alice](assets/84inspector.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)

[__`<< Previous`__](week11.md)
[___`Tips 78-84`___](week12.md)