Skip to content

Commit

Permalink
Massive Update
Browse files Browse the repository at this point in the history
  • Loading branch information
emrade committed Aug 8, 2019
1 parent 2834268 commit abace44
Show file tree
Hide file tree
Showing 20 changed files with 712 additions and 115 deletions.
Binary file added assets/images/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 4 additions & 13 deletions lib/_routing/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_social/_routing/routes.dart';
import 'package:flutter_social/views/chat_details.dart';
import 'package:flutter_social/views/home.dart';
import 'package:flutter_social/views/tabs/chats.dart';
import 'package:flutter_social/views/tabs/feeds.dart';
import 'package:flutter_social/views/landing.dart';
import 'package:flutter_social/views/login.dart';
import 'package:flutter_social/views/tabs/notifications.dart';
import 'package:flutter_social/views/tabs/profile.dart';
import 'package:flutter_social/views/register.dart';
import 'package:flutter_social/views/reset_password.dart';
import 'package:flutter_social/views/user_details.dart';

Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
Expand All @@ -23,16 +20,10 @@ Route<dynamic> generateRoute(RouteSettings settings) {
return MaterialPageRoute(builder: (context) => RegisterPage());
case resetPasswordViewRoute:
return MaterialPageRoute(builder: (context) => ResetPasswordPage());
case feedsViewRoute:
return MaterialPageRoute(builder: (context) => FeedsPage());
case notificationsViewRoute:
return MaterialPageRoute(builder: (context) => NotificationsPage());
case chatsViewRoute:
return MaterialPageRoute(builder: (context) => ChatsPage());
case chatDetailsViewRoute:
return MaterialPageRoute(builder: (context) => ChatDetailsPage());
case profileViewRoute:
return MaterialPageRoute(builder: (context) => ProfilePage());
return MaterialPageRoute(builder: (context) => ChatDetailsPage(userId: settings.arguments));
case userDetailsViewRoute:
return MaterialPageRoute(builder: (context) => UserDetailsPage(userId: settings.arguments));
break;
default:
return MaterialPageRoute(builder: (context) => LandingPage());
Expand Down
5 changes: 1 addition & 4 deletions lib/_routing/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ const String registerViewRoute = 'register';
const String resetPasswordViewRoute = 'reset_password';

const String homeViewRoute = 'home';
const String feedsViewRoute = 'feeds';
const String notificationsViewRoute = 'notifications';
const String chatsViewRoute = 'chats';
const String chatDetailsViewRoute = 'chat_details';
const String profileViewRoute = 'profile';
const String userDetailsViewRoute = 'user_details';
9 changes: 8 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_social/app.dart';
import 'package:flutter_social/utils/colors.dart';

void main() => runApp(App());
void main() {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: primaryDark
));
runApp(App());
}
15 changes: 15 additions & 0 deletions lib/models/message.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Message {
bool fromMe;
String body;

Message(this.body, this.fromMe);
}

List<Message> messages = [
Message("Hey! How's it going? 😀", false),
Message("Great thanks, i am looking forward to meeting you tomorrow 😍", true),
Message("Me too. Were you able to reach Frank?", false),
Message("Not yet", false),
Message("I'm sure he is asleep 😴", false),
Message("I was thinking the exact same thing!", true),
];
28 changes: 17 additions & 11 deletions lib/models/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@ class User {
String name;
String photo;
String location = 'Seattle, USA.';
String gender;
int age;

User(this.id, this.name, this.photo);
User(this.id, this.name, this.photo, this.gender, this.age);
}


// Names generated at http://random-name-generator.info/
final List<User> users = [
User(1, 'Matt Maxwell', AvailableImages.man1['assetPath']),
User(2, 'Maria Perez', AvailableImages.woman1['assetPath']),
User(3, 'Craig Jordan', AvailableImages.man2['assetPath']),
User(4, 'Charlotte Mckenzie', AvailableImages.woman2['assetPath']),
User(5, 'Rita Pena', AvailableImages.woman3['assetPath']),
User(6, 'Robin Mcguire', AvailableImages.man3['assetPath']),
User(7, 'Angelina Love', AvailableImages.woman4['assetPath']),
User(8, 'Louis Diaz', AvailableImages.man4['assetPath']),
User(9, 'Kyle Poole', AvailableImages.man5['assetPath']),
User(10, 'Brenda Watkins', AvailableImages.woman5['assetPath']),
User(1, 'Matt Maxwell', AvailableImages.man1['assetPath'], 'M', 27),
User(2, 'Maria Perez', AvailableImages.woman1['assetPath'], 'F', 24),
User(3, 'Craig Jordan', AvailableImages.man2['assetPath'], 'M', 28),
User(4, 'Charlotte Mckenzie', AvailableImages.woman2['assetPath'], 'F', 23),
User(5, 'Rita Pena', AvailableImages.woman3['assetPath'], 'F', 25),
User(6, 'Robin Mcguire', AvailableImages.man3['assetPath'], 'M', 29),
User(7, 'Angelina Love', AvailableImages.woman4['assetPath'], 'F', 22),
User(8, 'Louis Diaz', AvailableImages.man4['assetPath'], 'M', 23),
User(9, 'Kyle Poole', AvailableImages.man5['assetPath'], 'M', 25),
User(10, 'Brenda Watkins', AvailableImages.woman5['assetPath'], 'F', 26),
];

final List<String> userHobbies = [
"Dancing", "Hiking", "Singing", "Reading", "Fishing"
];
12 changes: 11 additions & 1 deletion lib/utils/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ const primaryGradient = const LinearGradient(
end: Alignment.bottomCenter,
);

const menuBarColor = const Color(0x552B2B2B);
const chatBubbleGradient = const LinearGradient(
colors: const [Color(0xFFFD60A3), Color(0xFFFF8961)],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
);

const chatBubbleGradient2 = const LinearGradient(
colors: const [Color(0xFFf4e3e3), Color(0xFFf4e3e3)],
begin: Alignment.topRight,
end: Alignment.bottomLeft,
);
5 changes: 5 additions & 0 deletions lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class AvailableImages {
'assetPath' : 'assets/images/post_banner.jpg',
};

static const emptyState = {
'assetImage' : AssetImage('assets/images/empty.png'),
'assetPath' : 'assets/images/empty.png',
};

static const homePage = const AssetImage('assets/images/home_page.png');
static const appLogo = const AssetImage('assets/images/logo.png');
}
150 changes: 148 additions & 2 deletions lib/views/chat_details.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,156 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_social/_routing/routes.dart';
import 'package:flutter_social/models/message.dart';
import 'package:flutter_social/models/user.dart';
import 'package:flutter_social/widgets/chat_bubble.dart';

class ChatDetailsPage extends StatelessWidget {
final int userId;
const ChatDetailsPage({Key key, this.userId}) : super(key: key);

@override
Widget build(BuildContext context) {
final User user = users.singleWhere((user) => user.id == userId);

final deviceHeight = MediaQuery.of(context).size.height;
final deviceWidth = MediaQuery.of(context).size.width;

final userImage = InkWell(
onTap: () => Navigator.pushNamed(context, userDetailsViewRoute, arguments: user.id),
child: Hero(
tag: user.photo,
child: Container(
margin: EdgeInsets.only(right: 8.0, bottom: 10.0),
height: 50.0,
width: 50.0,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(user.photo),
fit: BoxFit.cover,
),
shape: BoxShape.circle,
),
),
),
);

final userName = Hero(
tag: user.name,
child: Text(
user.name,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
);

final appBar = Material(
elevation: 5.0,
shadowColor: Colors.grey,
child: Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
onPressed: () => Navigator.pop(context),
icon: Icon(Icons.arrow_back),
),
userName,
userImage
],
),
),
);

final textInput = Container(
padding: EdgeInsets.only(left: 10.0),
height: 47.0,
width: deviceWidth * 0.7,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
color: Colors.white,
),
child: TextField(
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Type a message...',
hintStyle: TextStyle(
color: Colors.grey.withOpacity(0.6),
fontWeight: FontWeight.w600,
),
),
),
);

final messageList = ListView.builder(
scrollDirection: Axis.vertical,
itemCount: messages.length,
itemBuilder: (BuildContext context, int index) {
return ChatBubble(
message: messages[index],
);
},
);

final inputBox = Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 60.0,
width: deviceHeight,
decoration: BoxDecoration(
color: Colors.grey.shade200,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
IconButton(
onPressed: () {},
icon: Icon(
Icons.camera_alt,
color: Colors.grey,
),
iconSize: 32.0,
),
textInput,
IconButton(
onPressed: () {},
icon: Icon(
Icons.send,
color: Colors.grey,
),
iconSize: 32.0,
),
],
),
),
);

return Scaffold(

body: Stack(
children: <Widget>[
Container(
height: deviceHeight,
width: deviceWidth,
child: Column(
children: <Widget>[
appBar,
SizedBox(
height: 10.0,
),
Flexible(
child: messageList,
),
],
),
),
inputBox
],
),
);
}
}
}
6 changes: 6 additions & 0 deletions lib/views/landing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import 'package:flutter/material.dart';
import 'package:flutter_social/_routing/routes.dart';
import 'package:flutter_social/utils/colors.dart';
import 'package:flutter_social/utils/utils.dart';
import 'package:flutter/services.dart';

class LandingPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// Change Status Bar Color
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: primaryColor),
);

final logo = Container(
height: 100.0,
width: 100.0,
Expand Down
5 changes: 5 additions & 0 deletions lib/views/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_social/_routing/routes.dart';
import 'package:flutter_social/utils/colors.dart';
import 'package:line_icons/line_icons.dart';
import 'package:flutter/services.dart';

class LoginPage extends StatefulWidget {
@override
Expand All @@ -13,6 +14,10 @@ class _LoginPageState extends State<LoginPage> {

@override
Widget build(BuildContext context) {
// Change Status Bar Color
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: primaryColor),
);
final pageTitle = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expand Down
Loading

0 comments on commit abace44

Please sign in to comment.