Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chore: add change theme bloc, WhatsApp clone template
  • Loading branch information
javico2609 committed Mar 20, 2019
1 parent 58d6f42 commit f90c266
Show file tree
Hide file tree
Showing 20 changed files with 745 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@

### Screenshots

<img src="ss1.png" height="300em" /> <img src="ss2.png" height="300em" /> <img src="ss3.gif" height="300em" /> <img src="ss3.png" height="300em" />
<img src="ss1.png" height="300em" /> <img src="ss2.png" height="300em" /> <img src="ss3.gif" height="300em" /> <img src="ss3.png" height="300em" /> <img src="ss4.png" height="300em" />

### Created & Maintained By

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Expand Up @@ -34,7 +34,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.playgroundflutter"
minSdkVersion 16
minSdkVersion 21
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
11 changes: 11 additions & 0 deletions lib/bloc/theme.bloc.dart
@@ -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();
4 changes: 3 additions & 1 deletion lib/configs/routes.dart
Expand Up @@ -3,12 +3,14 @@ import 'package:playground_flutter/pages/navigation-bars/3d_bottom_navigation_ba
import 'package:playground_flutter/pages/navigation-bars/bottom_with_float_button.dart';
import 'package:playground_flutter/pages/templates/profile-one.dart';
import 'package:playground_flutter/pages/templates/trending.dart';
import 'package:playground_flutter/pages/templates/whatsapp-clone/whatsapp_home.dart';

var routes = {
'/': (context) => MyHomePage(),
'/BottomBarWithFloatButton': (context) => BottomBarWithFloatButton(),
'/ThreeDimenssionBottomNavigationBar': (context) =>
new ThreeDimenssionBottomNavigationBar(),
'/Trending': (context) => new Trending(),
'/ProfileOne': (context) => new ProfileOne()
'/ProfileOne': (context) => new ProfileOne(),
'/WhatsApp': (context) => new WhatsAppHome(),
};
17 changes: 17 additions & 0 deletions lib/configs/themes.dart
@@ -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();
}
}
34 changes: 34 additions & 0 deletions lib/data/calls_data.dart
@@ -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",
),
];
34 changes: 34 additions & 0 deletions lib/data/chats_data.dart
@@ -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",
),
];
1 change: 1 addition & 0 deletions lib/data/sidemenu.dart
Expand Up @@ -15,4 +15,5 @@ List<MenuModel> menu = [
'/ThreeDimenssionBottomNavigationBar'),
new MenuModel('Trending template', Icons.important_devices, '/Trending'),
new MenuModel('ProfileOne template', Icons.group, '/ProfileOne'),
new MenuModel('WhasApp template', Icons.whatshot, '/WhatsApp'),
];
21 changes: 13 additions & 8 deletions lib/main.dart
@@ -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,
);
}
);
}
}
10 changes: 10 additions & 0 deletions lib/models/call_model.dart
@@ -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});
}
8 changes: 8 additions & 0 deletions lib/models/chat_model.dart
@@ -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 lib/pages/templates/whatsapp-clone/pages/call_details.dart
@@ -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),
),
],
),
);
}
}

0 comments on commit f90c266

Please sign in to comment.