-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rody Davis
committed
Mar 14, 2019
1 parent
04142c8
commit b1d546a
Showing
6 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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,16 @@ | ||
# gmail_clone | ||
|
||
A new Flutter application to showcase how to build Gmail with Flutter. | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Flutter application. | ||
|
||
A few resources to get you started if this is your first Flutter project: | ||
|
||
- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) | ||
|
||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.io/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
This file contains 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export 'email_fab.dart'; | ||
export 'email_tile.dart'; | ||
export 'email_view.dart'; |
This file contains 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,74 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:gmail_clone/data/classes/email.dart'; | ||
|
||
import 'package:flutter_markdown/flutter_markdown.dart'; | ||
|
||
class EmailView extends StatefulWidget { | ||
EmailView({ | ||
@required this.item, | ||
this.favoriteChanged, | ||
}); | ||
|
||
final EmailItem item; | ||
final VoidCallback favoriteChanged; | ||
|
||
@override | ||
_EmailViewState createState() => _EmailViewState(); | ||
} | ||
|
||
class _EmailViewState extends State<EmailView> { | ||
String _preview; | ||
|
||
@override | ||
void initState() { | ||
rootBundle.loadString("assets/email_preview.md").then((data) { | ||
setState(() { | ||
print("Data: $data"); | ||
_preview = data; | ||
}); | ||
}); | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
if (_preview == null) { | ||
return Container( | ||
child: Center( | ||
child: CircularProgressIndicator(), | ||
), | ||
); | ||
} | ||
|
||
return Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: <Widget>[ | ||
Container( | ||
padding: EdgeInsets.all(12.0), | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: <Widget>[ | ||
Expanded( | ||
child: Text( | ||
widget.item?.title ?? "", | ||
maxLines: 2, | ||
style: Theme.of(context).textTheme.title, | ||
), | ||
), | ||
IconButton( | ||
icon: (widget.item?.favorite ?? false) | ||
? Icon(Icons.star, color: Colors.amber) | ||
: Icon(Icons.star_border), | ||
onPressed: widget.favoriteChanged, | ||
), | ||
], | ||
), | ||
), | ||
Expanded( | ||
child: Markdown(data: _preview), | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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