Skip to content

Commit

Permalink
profile two done
Browse files Browse the repository at this point in the history
  • Loading branch information
iampawan committed Jun 26, 2018
1 parent c03ac2a commit 65f84fc
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 29 deletions.
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter_uikit/myapp.dart';

void main() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
MaterialPageRoute.debugEnableFadingRoutes = true;
Injector.configure(Flavor.MOCK);
runApp(MyApp());
}
4 changes: 3 additions & 1 deletion lib/model/post.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Post {
int likesCount;
int commentsCount;
String postTime;
List<String> photos;

Post(
{this.personName,
Expand All @@ -16,5 +17,6 @@ class Post {
this.commentsCount,
this.likesCount,
this.messageImage,
this.postTime});
this.postTime,
this.photos});
}
4 changes: 3 additions & 1 deletion lib/myapp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter_uikit/ui/page/login/login_page.dart';
import 'package:flutter_uikit/ui/page/notfound/notfound_page.dart';
import 'package:flutter_uikit/ui/page/payment/credit_card_page.dart';
import 'package:flutter_uikit/ui/page/profile/profile_one_page.dart';
import 'package:flutter_uikit/ui/page/profile/profile_two_page.dart';
import 'package:flutter_uikit/ui/page/settings/settings_one_page.dart';
import 'package:flutter_uikit/ui/page/shopping/product_detail_page.dart';
import 'package:flutter_uikit/ui/page/shopping/shopping_details_page.dart';
Expand All @@ -25,13 +26,14 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.amber),
debugShowCheckedModeBanner: false,
showPerformanceOverlay: false,
home: HomePage(),
home: ProfileTwoPage(),
// initialRoute: UIData.notFoundRoute,

//routes
routes: <String, WidgetBuilder>{
UIData.homeRoute: (BuildContext context) => HomePage(),
UIData.profileOneRoute: (BuildContext context) => ProfileOnePage(),
UIData.profileTwoRoute: (BuildContext context) => ProfileTwoPage(),
UIData.timelineOneRoute: (BuildContext context) => TimelineOnePage(),
UIData.timelineTwoRoute: (BuildContext context) => TimelineTwoPage(),
UIData.notFoundRoute: (BuildContext context) => NotFoundPage(),
Expand Down
52 changes: 27 additions & 25 deletions lib/ui/page/profile/profile_one_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,7 @@ class ProfileOnePage extends StatelessWidget {
);

//column2
Widget followColumn() => Container(
height: deviceSize.height * 0.13,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ProfileTile(
title: "1.5K",
subtitle: "Posts",
),
ProfileTile(
title: "2.5K",
subtitle: "Followers",
),
ProfileTile(
title: "10K",
subtitle: "Comments",
),
ProfileTile(
title: "1.2K",
subtitle: "Following",
)
],
),
);

//column3
Widget descColumn() => Container(
height: deviceSize.height * 0.13,
Expand Down Expand Up @@ -145,7 +122,7 @@ class ProfileOnePage extends StatelessWidget {
children: <Widget>[
profileColumn(),
CommonDivider(),
followColumn(),
followColumn(deviceSize),
CommonDivider(),
descColumn(),
CommonDivider(),
Expand All @@ -169,3 +146,28 @@ class ProfileOnePage extends StatelessWidget {
return _scaffold();
}
}

Widget followColumn(Size deviceSize) => Container(
height: deviceSize.height * 0.13,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ProfileTile(
title: "1.5K",
subtitle: "Posts",
),
ProfileTile(
title: "2.5K",
subtitle: "Followers",
),
ProfileTile(
title: "10K",
subtitle: "Comments",
),
ProfileTile(
title: "1.2K",
subtitle: "Following",
)
],
),
);
156 changes: 156 additions & 0 deletions lib/ui/page/profile/profile_two_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import 'package:flutter/material.dart';
import 'package:flutter_uikit/ui/page/profile/profile_one_page.dart';
import 'package:flutter_uikit/ui/widgets/common_scaffold.dart';
import 'package:random_pk/random_pk.dart';

class ProfileTwoPage extends StatelessWidget {
Size deviceSize;

Widget profileHeader() => Container(
height: deviceSize.height / 4,
width: double.infinity,
color: Colors.black,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Card(
color: Colors.black,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.0),
border: Border.all(width: 2.0, color: Colors.white)),
child: CircleAvatar(
radius: 40.0,
backgroundImage: NetworkImage(
"https://avatars0.githubusercontent.com/u/12619420?s=460&v=4"),
),
),
Text(
"Pawan Kumar",
style: TextStyle(color: Colors.white, fontSize: 20.0),
),
Text(
"Flutter Developer",
style: TextStyle(color: Colors.white),
)
],
),
),
),
);
Widget imagesCard() => Container(
height: deviceSize.height / 6,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Photos",
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 18.0),
),
),
Expanded(
child: Card(
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 5,
itemBuilder: (context, i) => Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network(
"https://cdn.pixabay.com/photo/2016/10/31/18/14/ice-1786311_960_720.jpg"),
),
),
),
),
],
),
),
);

Widget profileColumn() => Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
CircleAvatar(
backgroundImage: NetworkImage(
"https://avatars0.githubusercontent.com/u/12619420?s=460&v=4"),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
"Pawan Kumar posted a photo",
),
SizedBox(
height: 5.0,
),
Text(
"25 mins ago",
)
],
),
))
],
),
);

Widget postCard() => Container(
width: double.infinity,
height: deviceSize.height / 3,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Post",
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 18.0),
),
),
profileColumn(),
Expanded(
child: Card(
elevation: 2.0,
child: Image.network(
"https://cdn.pixabay.com/photo/2018/06/12/01/04/road-3469810_960_720.jpg",
fit: BoxFit.cover,
),
),
),
],
),
),
);
Widget bodyData() => SingleChildScrollView(
child: Column(
children: <Widget>[
profileHeader(),
followColumn(deviceSize),
imagesCard(),
postCard(),
],
),
);

@override
Widget build(BuildContext context) {
deviceSize = MediaQuery.of(context).size;
return CommonScaffold(
appTitle: "Profile",
bodyData: bodyData(),
elevation: 0.0,
);
}
}
7 changes: 5 additions & 2 deletions lib/ui/widgets/common_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ class CommonScaffold extends StatelessWidget {
final showBottomNav;
final floatingIcon;
final centerDocked;
final elevation;

CommonScaffold(
{this.appTitle,
this.bodyData,
this.showFAB,
this.showFAB = false,
this.showDrawer = false,
this.backGroundColor,
this.actionFirstIcon = Icons.search,
this.scaffoldKey,
this.showBottomNav = false,
this.centerDocked = false,
this.floatingIcon});
this.floatingIcon,
this.elevation = 4.0});

Widget myBottomBar() => new BottomAppBar(
hasNotch: true,
Expand Down Expand Up @@ -85,6 +87,7 @@ class CommonScaffold extends StatelessWidget {
key: scaffoldKey != null ? scaffoldKey : null,
backgroundColor: backGroundColor != null ? backGroundColor : null,
appBar: AppBar(
elevation: elevation,
backgroundColor: Colors.black,
title: Text(appTitle),
actions: <Widget>[
Expand Down
1 change: 1 addition & 0 deletions lib/utils/uidata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class UIData {
//routes
static const String homeRoute = "/home";
static const String profileOneRoute = "/View Profile";
static const String profileTwoRoute = "/Profile 2";
static const String notFoundRoute = "/No Search Result";
static const String timelineOneRoute = "/Feed";
static const String timelineTwoRoute = "/Tweets";
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.29.0+1"
random_pk:
dependency: "direct dev"
description:
name: random_pk
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.3"
rxdart:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies:
flutter_masked_text:

dev_dependencies:
random_pk:
flutter_test:
sdk: flutter

Expand Down

0 comments on commit 65f84fc

Please sign in to comment.