Skip to content

Commit

Permalink
Merge pull request #1 from TheAlphamerc/develop
Browse files Browse the repository at this point in the history
merge develop branch to master
  • Loading branch information
TheAlphamerc committed Feb 25, 2020
2 parents df50a37 + dea30a7 commit 5cb8291
Show file tree
Hide file tree
Showing 28 changed files with 1,303 additions and 867 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
.flutter-plugins-dependencies
android/app/google-services.json
1 change: 1 addition & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M

android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
1 change: 1 addition & 0 deletions lib/helper/enum.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ enum AuthStatus {
}
enum TweetType{
Tweet,
Detail,
Reply
}
74 changes: 74 additions & 0 deletions lib/helper/routes.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import '../page/Auth/signin.dart';
import '../helper/customRoute.dart';
import '../page/feed/createFeed.dart';
import '../page/feed/imageViewPage.dart';
import '../page/SearchPage.dart';
import '../page/Auth/forgetPasswordPage.dart';
import '../page/Auth/signin.dart';
import '../page/Auth/signup.dart';
import '../page/feed/feedPostDetail.dart';
import '../page/feed/feedPostreply.dart';
import '../page/profile/EditProfilePage.dart';
import '../page/message/chatScreenPage.dart';
import '../page/profile/profilePage.dart';
import '../widgets/customWidgets.dart';

class Routes{
static Route onGenerateRoute(RouteSettings settings) {
final List<String> pathElements = settings.name.split('/');
if (pathElements[0] != '' || pathElements.length == 1) {
return null;
}
if(pathElements[1].contains('SignIn')){
return CustomRoute<bool>(builder:(BuildContext context)=> SignIn());
}
else if(pathElements[1].contains('SignUp')){
return CustomRoute<bool>(builder:(BuildContext context)=> Signup());
}
else if(pathElements[1].contains('SearchPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> SearchPage());
}
else if(pathElements[1].contains('CreateFeedPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> CreateFeedPage());
}
else if(pathElements[1].contains('FeedPostReplyPage')){
var postId = pathElements[2];
return CustomRoute<bool>(builder:(BuildContext context)=> FeedPostReplyPage(postId: postId,));
}
else if(pathElements[1].contains('FeedPostDetail')){
var postId = pathElements[2];
return CustomRoute<bool>(builder:(BuildContext context)=> FeedPostDetail(postId: postId,));
}
else if(pathElements[1].contains('ForgetPasswordPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> ForgetPasswordPage());
}
else if(pathElements[1].contains('ImageViewPge')){
return CustomRoute<bool>(builder:(BuildContext context)=> ImageViewPge());
}
else if(pathElements[1].contains('ProfilePage')){
String profileId;
if(pathElements.length > 2){
profileId = pathElements[2];
}
return CustomRoute<bool>(builder:(BuildContext context)=> ProfilePage(profileId: profileId,));
}
else if(pathElements[1].contains('EditProfile')){
return CustomRoute<bool>(builder:(BuildContext context)=> EditProfilePage());
}
else if(pathElements[1].contains('ChatScreenPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> ChatScreenPage());
}
}

static Route onUnknownRoute(RouteSettings settings){
return MaterialPageRoute(
builder: (_) => Scaffold(
appBar: AppBar(title: customTitleText(settings.name.split('/')[1]),centerTitle: true,),
body: Center(
child: Text('${settings.name.split('/')[1]} Comming soon..'),
),
),
);
}
}
9 changes: 4 additions & 5 deletions lib/helper/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ BoxDecoration softDecoration = BoxDecoration(
],
color: Color(0xfff1f3f6)
);
TextStyle get titleStyle { return TextStyle(color: Colors.black,fontSize: 18,fontWeight: FontWeight.bold);}
TextStyle get subtitleStyle { return TextStyle(color: Colors.black54,fontSize: 15,fontWeight: FontWeight.bold);}
TextStyle get userNameStyle { return TextStyle(color: AppColor.darkGrey,fontSize: 17,fontWeight: FontWeight.bold);}
TextStyle get titleStyle { return TextStyle(color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold,);}
TextStyle get subtitleStyle { return TextStyle(color: Colors.black54,fontSize: 14,fontWeight: FontWeight.bold);}
TextStyle get userNameStyle { return TextStyle(color: AppColor.darkGrey,fontSize: 14,fontWeight: FontWeight.bold);}

class TwitterColor {
static final Color bondiBlue = Color.fromRGBO(0, 132, 180, 1.0);
Expand Down Expand Up @@ -44,7 +44,7 @@ class AppColor{
class AppTheme{
static final ThemeData apptheme = ThemeData(
primarySwatch: Colors.blue,
fontFamily: 'HelveticaNeue',
// fontFamily: 'HelveticaNeue',
backgroundColor: Colors.white,
accentColor: TwitterColor.dodgetBlue.withAlpha(20),
brightness: Brightness.light,
Expand All @@ -61,7 +61,6 @@ class AppTheme{
elevation: 0,
textTheme: TextTheme(
title: TextStyle(
fontFamily: 'HelveticaNeue',
color: Colors.black,
fontSize: 26,
fontStyle: FontStyle.normal),
Expand Down
95 changes: 20 additions & 75 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_twitter_clone/helper/theme.dart';
import 'helper/customRoute.dart';
import 'helper/routes.dart';
import 'page/Auth/selectAuthMethod.dart';
import 'page/feed/createFeed.dart';
import 'page/feed/imageViewPage.dart';
Expand All @@ -19,87 +20,34 @@ import 'state/authState.dart';
import 'state/chats/chatState.dart';
import 'state/feedState.dart';
import 'widgets/customWidgets.dart';
import 'package:google_fonts/google_fonts.dart';

void main() => runApp(MyApp());
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}

class MyApp extends StatelessWidget {
AuthState _authState = AuthState();
FeedState _feedState = FeedState();
AppState _appState = AppState();
ChatState _chatState = ChatState();
@override
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider<AppState>( create: (_) =>_appState),
ChangeNotifierProvider<AuthState>( create: (_) =>_authState),
ChangeNotifierProvider<FeedState>( create: (_) =>_feedState),
ChangeNotifierProvider<ChatState>( create: (_) =>_chatState),
ChangeNotifierProvider<AppState>(create: (_) => AppState()),
ChangeNotifierProvider<AuthState>(create: (_) => AuthState()),
ChangeNotifierProvider<FeedState>(create: (_) => FeedState()),
ChangeNotifierProvider<ChatState>(create: (_) => ChatState()),
],
child: MaterialApp(
child: MaterialApp(
title: 'Flutter Demo',
theme:AppTheme.apptheme,
// Theme.of(context).copyWith(
// appBarTheme: apptheme.appBarTheme,

// backgroundColor: apptheme.backgroundColor,
// // colorScheme: apptheme.colorScheme,
// floatingActionButtonTheme:apptheme.floatingActionButtonTheme),
theme: AppTheme.apptheme.copyWith(
textTheme: GoogleFonts.muliTextTheme(
Theme.of(context).textTheme,
),
),
debugShowCheckedModeBanner: false,
home: MyHomePage(),
onGenerateRoute: (RouteSettings settings) {
final List<String> pathElements = settings.name.split('/');
if (pathElements[0] != '' || pathElements.length == 1) {
return null;
}
if(pathElements[1].contains('SignIn')){
return CustomRoute<bool>(builder:(BuildContext context)=> SignIn());
}
else if(pathElements[1].contains('SignUp')){
return CustomRoute<bool>(builder:(BuildContext context)=> Signup());
}
else if(pathElements[1].contains('SearchPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> SearchPage());
}
else if(pathElements[1].contains('CreateFeedPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> CreateFeedPage());
}
else if(pathElements[1].contains('FeedPostReplyPage')){
var postId = pathElements[2];
return CustomRoute<bool>(builder:(BuildContext context)=> FeedPostReplyPage(postId: postId,));
}
else if(pathElements[1].contains('FeedPostDetail')){
var postId = pathElements[2];
return CustomRoute<bool>(builder:(BuildContext context)=> FeedPostDetail(postId: postId,));
}
else if(pathElements[1].contains('ForgetPasswordPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> ForgetPasswordPage());
}
else if(pathElements[1].contains('ImageViewPge')){
return CustomRoute<bool>(builder:(BuildContext context)=> ImageViewPge());
}
else if(pathElements[1].contains('ProfilePage')){
String profileId;
if(pathElements.length > 2){
profileId = pathElements[2];
}
return CustomRoute<bool>(builder:(BuildContext context)=> ProfilePage(profileId: profileId,));
}
else if(pathElements[1].contains('EditProfile')){
return CustomRoute<bool>(builder:(BuildContext context)=> EditProfilePage());
}
else if(pathElements[1].contains('ChatScreenPage')){
return CustomRoute<bool>(builder:(BuildContext context)=> ChatScreenPage());
}
},
onUnknownRoute: (settings) => MaterialPageRoute(
builder: (_) => Scaffold(
appBar: AppBar(title: customTitleText(settings.name.split('/')[1]),centerTitle: true,),
body: Center(
child: Text('${settings.name.split('/')[1]} Comming soon..'),
),
),
),
onGenerateRoute: (settings) => Routes.onGenerateRoute(settings),
onUnknownRoute: (settings) => Routes.onUnknownRoute(settings),
),
);
}
Expand All @@ -111,11 +59,8 @@ class MyHomePage extends StatefulWidget {
}

class _MyHomePageState extends State<MyHomePage> {

@override
Widget build(BuildContext context) {
return Scaffold(
body: SelectAuthMethod()
);
return Scaffold(body: SelectAuthMethod());
}
}
37 changes: 34 additions & 3 deletions lib/model/feedModel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_twitter_clone/model/user.dart';

class FeedModel {
String key;
String parentkey;
String description;
String userId;
bool isVerifiedUser;
Expand All @@ -12,8 +13,23 @@ class FeedModel {
String createdAt;
String imagePath;
List<String> tags;
List<String> replyTweetKeyList;
User user;
FeedModel({this.key,this.description, this.userId,this.likeCount,this.commentCount,this.createdAt,this.imagePath,this.likeList,this.tags,this.isVerifiedUser,this.user});
FeedModel({
this.key,
this.description,
this.userId,
this.likeCount,
this.commentCount,
this.createdAt,
this.imagePath,
this.likeList,
this.tags,
this.isVerifiedUser,
this.user,
this.replyTweetKeyList,
this.parentkey,
});
toJson() {
Map<dynamic,dynamic> map;
if(likeList != null && likeList.length > 0){
Expand All @@ -31,8 +47,10 @@ class FeedModel {
"imagePath":imagePath,
"likeList":map,
"tags":tags,
"replyTweetKeyList":replyTweetKeyList,
"isVerifiedUser":isVerifiedUser ?? false,
"user":user == null ? null : user.toJson()
"user":user == null ? null : user.toJson(),
"parentkey": parentkey
};
}
dynamic getLikeList(List<String> list){
Expand All @@ -58,7 +76,7 @@ class FeedModel {
// username = map['username'];
isVerifiedUser = map['isVerifiedUser'] ?? false;
user = User.fromJson(map['user']);
// tags = map['tags'];
parentkey = map['parentkey'];
if(map['tags'] != null){
tags = List<String>();
map['tags'].forEach((value){
Expand All @@ -78,6 +96,19 @@ class FeedModel {
likeList = [];
likeCount = 0;
}
if(map['replyTweetKeyList'] != null){
map['replyTweetKeyList'].forEach((value){
replyTweetKeyList = List<String>();
map['replyTweetKeyList'].forEach((value){
replyTweetKeyList.add(value);
});
});
commentCount = replyTweetKeyList.length;
}
else{
replyTweetKeyList = [];
commentCount = 0;
}
}
}
class LikeList{
Expand Down
4 changes: 2 additions & 2 deletions lib/model/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class User {
following = map['following'] ?? 0;
userName = map['userName'];
webSite = map['webSite'];
isVerified = map['isVerified'];
isVerified = map['isVerified'] ?? false;
}
toJson() {
return {
Expand All @@ -54,7 +54,7 @@ class User {
'following':following ?? 0,
'userName':userName,
'webSite':webSite,
'isVerified':isVerified
'isVerified':isVerified ?? false
};
}
}
2 changes: 1 addition & 1 deletion lib/page/Auth/forgetPasswordPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage>{
void initState() {
_focusNode = FocusNode();
_emailController = TextEditingController();
_emailController.text = 'sonu.sharma@kritivity.com';
_emailController.text = '';
_focusNode.requestFocus();
super.initState();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/page/Auth/signin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
],
),
_labelButton('Forget password?',onPressed: (){
Navigator.of(context).pushNamed('/CreateFeedPage');
Navigator.of(context).pushNamed('/ForgetPasswordPage');
}),
SizedBox(height: 100,),
_labelButton('Create new account',onPressed: _createAccount),
Expand Down Expand Up @@ -134,7 +134,7 @@ final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
// widget.loginCallback();
},
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 10),
child: Text('google Login',style:TextStyle(color: Colors.white)),
child: Text('Google Login',style:TextStyle(color: Colors.white)),
)
);
}
Expand Down
Loading

0 comments on commit 5cb8291

Please sign in to comment.