Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
chore: add change theme bloc, WhatsApp clone template
- Loading branch information
1 parent
58d6f42
commit f90c266
Showing
20 changed files
with
745 additions
and
11 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:playground_flutter/configs/themes.dart'; | ||
|
||
class ThemeBloc { | ||
final StreamController<Themes> _themeController = StreamController<Themes>(); | ||
get changeTheme => _themeController.sink.add; | ||
get themeEnabled => _themeController.stream; | ||
} | ||
|
||
final themeBloc = ThemeBloc(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
enum Themes { light, dark, whapsapp } | ||
|
||
ThemeData getThemeByType(Themes type) { | ||
switch (type) { | ||
case Themes.dark: | ||
return ThemeData.dark(); | ||
case Themes.whapsapp: | ||
return ThemeData( | ||
primaryColor: new Color(0xff075E54), | ||
accentColor: new Color(0xff25D366), | ||
); | ||
default: | ||
ThemeData.light(); | ||
} | ||
} |
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,34 @@ | ||
|
||
|
||
import 'package:playground_flutter/models/call_model.dart'; | ||
|
||
final List<CallModel> calls = [ | ||
new CallModel( | ||
name: 'Javier González', | ||
time: "12:30 PM", | ||
type: CallType.Call, | ||
avatar: | ||
"http://www.usanetwork.com/sites/usanetwork/files/styles/629x720/public/suits_cast_harvey.jpg?itok=fpTOeeBb", | ||
), | ||
new CallModel( | ||
name: 'Daynelis Cruz', | ||
time: "12:32 PM", | ||
type: CallType.Call, | ||
avatar: | ||
"https://heavyeditorial.files.wordpress.com/2017/07/jessica-johnson-5.jpg?w=531&quality=65&strip=all&h=531", | ||
), | ||
new CallModel( | ||
name: 'Javier González', | ||
time: "12:35 PM", | ||
type: CallType.Video, | ||
avatar: | ||
"http://www.usanetwork.com/sites/usanetwork/files/styles/629x720/public/suits_cast_harvey.jpg?itok=fpTOeeBb", | ||
), | ||
new CallModel( | ||
name: 'Daynelis Cruz', | ||
time: "12:36 PM", | ||
type: CallType.Call, | ||
avatar: | ||
"https://heavyeditorial.files.wordpress.com/2017/07/jessica-johnson-5.jpg?w=531&quality=65&strip=all&h=531", | ||
), | ||
]; |
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,34 @@ | ||
|
||
import 'package:playground_flutter/models/chat_model.dart'; | ||
|
||
final List<ChatModel> chats = [ | ||
new ChatModel( | ||
name: 'Javier González', | ||
message: | ||
"Mima estoy en el Shopping, quieres que compre algo para la cena ?", | ||
time: "12:30 PM", | ||
avatar: | ||
"http://www.usanetwork.com/sites/usanetwork/files/styles/629x720/public/suits_cast_harvey.jpg?itok=fpTOeeBb", | ||
), | ||
new ChatModel( | ||
name: 'Daynelis Cruz', | ||
message: "Revisa si hay tomates frescos en el mercado", | ||
time: "12:32 PM", | ||
avatar: | ||
"https://heavyeditorial.files.wordpress.com/2017/07/jessica-johnson-5.jpg?w=531&quality=65&strip=all&h=531", | ||
), | ||
new ChatModel( | ||
name: 'Javier González', | ||
message: "OK, algo más ?", | ||
time: "12:35 PM", | ||
avatar: | ||
"http://www.usanetwork.com/sites/usanetwork/files/styles/629x720/public/suits_cast_harvey.jpg?itok=fpTOeeBb", | ||
), | ||
new ChatModel( | ||
name: 'Daynelis Cruz', | ||
message: "No, solo eso necesito", | ||
time: "12:36 PM", | ||
avatar: | ||
"https://heavyeditorial.files.wordpress.com/2017/07/jessica-johnson-5.jpg?w=531&quality=65&strip=all&h=531", | ||
), | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:playground_flutter/bloc/theme.bloc.dart'; | ||
import 'package:playground_flutter/configs/routes.dart'; | ||
import 'package:playground_flutter/configs/themes.dart'; | ||
|
||
void main() => runApp(MyApp()); | ||
|
||
class MyApp extends StatelessWidget { | ||
// This widget is the root of your application. | ||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
title: 'Flutter Demo', | ||
theme: ThemeData( | ||
primarySwatch: Colors.blue, | ||
), | ||
initialRoute: '/', | ||
debugShowCheckedModeBanner: false, | ||
routes: routes, | ||
return StreamBuilder<Object>( | ||
stream: themeBloc.themeEnabled, | ||
builder: (context, snapshot) { | ||
return MaterialApp( | ||
title: 'Flutter Demo', | ||
theme: getThemeByType(snapshot.data), | ||
initialRoute: '/', | ||
debugShowCheckedModeBanner: false, | ||
routes: routes, | ||
); | ||
} | ||
); | ||
} | ||
} |
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,10 @@ | ||
enum CallType { Call, Video } | ||
|
||
class CallModel { | ||
final String name; | ||
final String time; | ||
final String avatar; | ||
final CallType type; | ||
|
||
CallModel({this.name, this.type, this.time, this.avatar}); | ||
} |
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,8 @@ | ||
class ChatModel { | ||
final String name; | ||
final String message; | ||
final String time; | ||
final String avatar; | ||
|
||
ChatModel({this.name, this.message, this.time, this.avatar}); | ||
} |
179 changes: 179 additions & 0 deletions
179
lib/pages/templates/whatsapp-clone/pages/call_details.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,179 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:playground_flutter/models/call_model.dart'; | ||
|
||
class CallDetail extends StatelessWidget { | ||
final CallModel call; | ||
|
||
CallDetail({Key key, @required this.call}) : super(key: key); | ||
|
||
Widget buildHeader(BuildContext context) { | ||
return Container( | ||
color: Colors.white, | ||
height: 100.0, | ||
alignment: Alignment.center, | ||
child: new ListTile( | ||
leading: new Container( | ||
height: 70.0, | ||
width: 70.0, | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(40.0), | ||
image: DecorationImage( | ||
image: new NetworkImage(call.avatar), | ||
fit: BoxFit.scaleDown, | ||
), | ||
), | ||
), | ||
title: new Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: <Widget>[ | ||
new Text( | ||
call.name, | ||
style: new TextStyle(fontSize: 25.0), | ||
), | ||
Row( | ||
children: <Widget>[ | ||
new Icon( | ||
Icons.call, | ||
color: Theme.of(context).primaryColor, | ||
size: 30.0, | ||
), | ||
SizedBox(width: 20.0), | ||
new Icon( | ||
Icons.videocam, | ||
color: Theme.of(context).primaryColor, | ||
size: 30.0, | ||
) | ||
], | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
backgroundColor: new Color(0xff075E54), | ||
title: Text('Call info'), | ||
actions: <Widget>[ | ||
new Container( | ||
width: 80.0, | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
children: <Widget>[ | ||
new Icon( | ||
Icons.chat, | ||
color: Colors.white, | ||
), | ||
new Icon( | ||
Icons.more_vert, | ||
color: Colors.white, | ||
) | ||
], | ||
), | ||
) | ||
], | ||
), | ||
body: Container( | ||
color: Colors.grey[300], | ||
child: Column( | ||
children: <Widget>[ | ||
buildHeader(context), | ||
Expanded( | ||
child: Container( | ||
padding: EdgeInsets.all(12.0), | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(5.0), | ||
color: Colors.white, | ||
), | ||
child: ListView( | ||
children: <Widget>[ | ||
new ListTile( | ||
title: new Text( | ||
'31 de diciembre de 2018', | ||
style: TextStyle( | ||
color: Theme.of(context).primaryColor, | ||
fontSize: 20.0, | ||
), | ||
), | ||
), | ||
new Divider(), | ||
buildListItem(context), | ||
new Divider(), | ||
buildListItem(context), | ||
new Divider(), | ||
buildListItem(context), | ||
new Divider(), | ||
buildListItem(context), | ||
new Divider(), | ||
buildListItem(context), | ||
new Divider(), | ||
buildListItem(context), | ||
new Divider() | ||
], | ||
), | ||
), | ||
), | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
ListTile buildListItem(BuildContext context) { | ||
return new ListTile( | ||
title: Row( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Column( | ||
children: <Widget>[ | ||
SizedBox(height: 5.0), | ||
new Icon( | ||
Icons.call_received, | ||
color: Theme.of(context).accentColor, | ||
size: 17.0, | ||
), | ||
], | ||
), | ||
SizedBox(width: 10.0), | ||
Expanded( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
new Text( | ||
"Entrante", | ||
style: TextStyle( | ||
fontWeight: FontWeight.bold, | ||
fontSize: 20.0, | ||
), | ||
), | ||
SizedBox(height: 5.0), | ||
new Text( | ||
"10:38 pm", | ||
style: TextStyle(fontSize: 17.0), | ||
), | ||
], | ||
), | ||
) | ||
], | ||
), | ||
trailing: new Column( | ||
children: <Widget>[ | ||
new Text( | ||
"0:07", | ||
style: TextStyle(fontSize: 17.0), | ||
), | ||
SizedBox(height: 5.0), | ||
new Text( | ||
"18 kb", | ||
style: TextStyle(fontSize: 17.0), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.