-
Notifications
You must be signed in to change notification settings - Fork 247
[101] Complete #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
willlarche
merged 17 commits into
material-components:master
from
willlarche:feature-101-complete
Apr 6, 2018
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a1ab2c7
[101] Complete.
willlarche 244446e
[101] Pubspec.
willlarche 0ac931c
[101] .gitignore.
willlarche fe6b56b
[101] .metadata.
willlarche 631ed80
[101] Correcting initial navigation.
willlarche 3f314dd
[101] Made opening route modal
willlarche 62c6a2f
[101] PR feedback.
willlarche 6f87fe9
[101] Removing unused import.
willlarche d1ad4c7
[101] PR feedback.
willlarche d37d8d6
[101] Formatting.
willlarche d5ed365
[101] Formatting.
willlarche a1fb7ff
[101] Formatting.
willlarche 1bd230f
[101] Formatting.
willlarche cee0927
[101] Adding password obscuring.
willlarche d213332
[101] PR feedback.
willlarche ca3d97d
[101] Replacing sizedBox and row with buttonBar.
willlarche 5ffab0c
[101] Getting rid of analyzer warning.
willlarche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.DS_Store | ||
.atom/ | ||
.dart_tool/ | ||
.idea | ||
.vscode/ | ||
.packages | ||
.pub/ | ||
build/ | ||
ios/.generated/ | ||
packages | ||
.flutter-plugins |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: 5a58b36e36b8d7aace89d3950e6deb307956a6a0 | ||
channel: beta |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'home.dart'; | ||
import 'login.dart'; | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
class ShrineApp extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Shrine', | ||
home: HomePage(), | ||
initialRoute: '/login', | ||
onGenerateRoute: _getRoute, | ||
); | ||
} | ||
|
||
Route<dynamic> _getRoute(RouteSettings settings) { | ||
if (settings.name != '/login') { | ||
return null; | ||
} | ||
|
||
return MaterialPageRoute<void>( | ||
settings: settings, | ||
builder: (BuildContext context) => LoginPage(), | ||
fullscreenDialog: true, | ||
); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class HomePage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('SHRINE'), | ||
), | ||
body: Center( | ||
child: Text('You did it!'), | ||
), | ||
); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class LoginPage extends StatelessWidget { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SafeArea( | ||
child: ListView( | ||
padding: EdgeInsets.symmetric(horizontal: 24.0), | ||
children: <Widget>[ | ||
SizedBox(height: 80.0), | ||
Column( | ||
children: <Widget>[ | ||
Image.asset('assets/diamond.png'), | ||
SizedBox(height: 16.0), | ||
Text('SHRINE'), | ||
], | ||
), | ||
SizedBox(height: 120.0), | ||
TextField( | ||
decoration: InputDecoration( | ||
filled: true, | ||
labelText: 'Username', | ||
), | ||
), | ||
SizedBox(height: 12.0), | ||
TextField( | ||
decoration: InputDecoration( | ||
filled: true, | ||
labelText: 'Password', | ||
), | ||
obscureText: true, | ||
), | ||
ButtonBar( | ||
children: <Widget>[ | ||
FlatButton( | ||
child: Text('CANCEL'), | ||
onPressed: null, | ||
), | ||
RaisedButton( | ||
child: Text('NEXT'), | ||
onPressed: () { | ||
Navigator.pop(context); | ||
}, | ||
) | ||
], | ||
) | ||
], | ||
), | ||
) | ||
); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'app.dart'; | ||
|
||
void main() => runApp(ShrineApp()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just FYI: optional new/const might not make it for I/O. That's a worst case scenario, but after the recent snafu, it's a lot more probable than before. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: mdc_101_complete | ||
description: > | ||
Learn the basics of using Material Components by building a simple app with core components. | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
|
||
cupertino_icons: ^0.1.0 | ||
|
||
dev_dependencies: | ||
flutter_test: | ||
sdk: flutter | ||
|
||
|
||
flutter: | ||
uses-material-design: true | ||
assets: | ||
- assets/diamond.png |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another comment that's more a question:
Is there a definite benefit to using onGenerateRoute here rather than supplying a map via the routes property? It may just be the examples I happen to be looking at right now, but that seems like a popular option:
https://github.com/brianegan/flutter_architecture_samples/blob/master/example/scoped_model/lib/app.dart
I don't know that you can set the fullScreenDialog option that way, though, which may be a dealbreaker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, I was not even aware of
onGenerateRoute
until now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's all new to me! Need me to change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, actually, I used to have the routes map. But I couldn't get the pop to be a modal-style dismiss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed offline, and this is definitely the better way to go. I'm now curious what other functionality you lose (if any) by using a straight up route table.