Skip to content

Profile page 01 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/profile/profile_arrow_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/profile/profile_avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/profile/profile_follow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/profile/profile_photos_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/profile/profile_photos_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/profile/profile_photos_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class MyApp extends StatelessWidget {
SIGN_UP_PAGES[0]: (context) => SignPageOne(),
SIGN_UP_PAGES[1]: (context) => SignPageTwo(),

//PROFILE pages
PROFILE_PAGES[0]: (context) => ProfilePageOne(),

///FEED group page
FEED_PAGES[0]: (context) => FeedPageOne(),
FEED_PAGES[0]: (context) => FeedPageOne(),
Expand Down
3 changes: 3 additions & 0 deletions lib/page/page_const.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export "empty_page.dart";
export 'signup/SignPageOne.dart';
export 'signup/SignPageTwo.dart';

//PROFILE pages
export 'profile/ProfilePageOne.dart';

export 'feed/FeedPageFour.dart';
export 'feed/FeedPageOne.dart';
export 'feed/FeedPageTen.dart';
Expand Down
314 changes: 308 additions & 6 deletions lib/page/profile/ProfilePageOne.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
///
/// Created by NieBin on 2018/12/25
/// Github: https://github.com/nb312
/// Email: niebin312@gmail.com
/// Created by Terrance Duong on 2019/01/03
/// Github: https://github.com/dndoanh
/// Email: dndoanh@gmail.com
///
import "package:flutter/material.dart";
import 'package:flutter_ui_nice/const/color_const.dart';
import 'package:flutter_ui_nice/page/profile/profile_const.dart';
import 'package:flutter_ui_nice/page/profile/top_bar.dart';
import 'package:flutter_ui_nice/util/SizeUtil.dart';

const photos = [
ProfileImages.photos_01,
ProfileImages.photos_02,
ProfileImages.photos_03,
];

class Photo {
Photo({this.path, this.isImage});

final String path;
final bool isImage;
}

class ProfilePageOne extends StatefulWidget {
@override
Expand All @@ -13,11 +30,296 @@ class ProfilePageOne extends StatefulWidget {
class _ProfileState extends State<ProfilePageOne> {
@override
Widget build(BuildContext context) {
Widget _itemPhoto(String img) {
return Container(
margin: EdgeInsets.only(
left: SizeUtil.getAxisX(10.0),
right: SizeUtil.getAxisX(10.0),
),
child: ClipRRect(
borderRadius: new BorderRadius.circular(22.0),
child: Image.asset(
img,
width: SizeUtil.getAxisBoth(PHOTO_BUTTON_HEIGHT),
height: SizeUtil.getAxisBoth(PHOTO_BUTTON_HEIGHT),
),
),
);
}

Widget _itemText(String txt) {
return Container(
margin: EdgeInsets.only(
left: SizeUtil.getAxisX(10.0),
right: SizeUtil.getAxisX(10.0),
),
constraints: BoxConstraints.expand(
height: SizeUtil.getAxisY(PHOTO_BUTTON_HEIGHT),
width: SizeUtil.getAxisX(PHOTO_BUTTON_HEIGHT),
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
colors: [Colors.redAccent, Colors.pinkAccent]),
borderRadius: BorderRadius.circular(22.0),
),
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
txt,
style: TextStyle(
color: ProfileColors.COLOR_WHITE,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_XL),
),
),
Text(
ProfileStrings.STRING_PHOTOS,
style: TextStyle(
color: ProfileColors.COLOR_WHITE,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_S),
),
)
],
),
),
);
}

Widget _buildPhotos() {
return Container(
constraints: BoxConstraints.expand(
height: SizeUtil.getAxisY(PHOTO_BUTTON_HEIGHT)),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: photos.length > 2 ? photos.length + 1 : photos.length,
itemBuilder: (context, idx) {
if (idx < 2) {
return _itemPhoto(photos[idx]);
} else if (idx == 2) {
if (photos.length > 2) {
return _itemText("+" + photos.length.toString());
} else {
return _itemPhoto(photos[idx]);
}
} else {
return _itemPhoto(photos[idx - 1]);
}
},
),
);
}

Widget _bottomBar() {
return Container(
constraints:
BoxConstraints.expand(height: SizeUtil.getAxisY(BOTTOM_BAR_HEIGHT)),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
width: SizeUtil.getAxisX(PHOTO_BUTTON_HEIGHT),
height: SizeUtil.getAxisY(PHOTO_BUTTON_HEIGHT),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x44FFFFFF), Color(0x44FFFFFF)],
begin: Alignment.topLeft,
end: Alignment.bottomRight),
borderRadius: BorderRadius.circular(
SizeUtil.getAxisX(22.0),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'17,589',
style: TextStyle(
color: TEXT_BLACK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_S),
fontWeight: FontWeight.w700,
),
),
Text(
'followers',
style: TextStyle(
color: ProfileColors.COLOR_DARK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_S),
),
)
],
),
),
Container(
width: SizeUtil.getAxisX(PHOTO_BUTTON_HEIGHT),
height: SizeUtil.getAxisY(PHOTO_BUTTON_HEIGHT),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'9,854',
style: TextStyle(
color: TEXT_BLACK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_S),
fontWeight: FontWeight.w700,
),
),
Text(
'following',
style: TextStyle(
color: ProfileColors.COLOR_DARK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_S),
),
)
],
),
)
],
),
);
}

return Scaffold(
appBar: AppBar(
title: Text("Profile one"),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [YELLOW, GREEN],
begin: Alignment.topLeft,
end: Alignment.centerLeft,
),
),
child: Column(
children: <Widget>[
TopBar(
leftIcon: ProfileImages.arrow_left,
onLeftIconPressed: () => Navigator.pop(context),
),
Expanded(
child: ListView(
children: <Widget>[
Container(
padding: EdgeInsets.only(
left: 100,
top: 30,
right: 15,
bottom: 30,
),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Image.asset(
ProfileImages.avatar,
width: SizeUtil.getAxisY(SQUARE_BUTTON_HEIGHT),
height: SizeUtil.getAxisY(SQUARE_BUTTON_HEIGHT),
),
Container(
width: SizeUtil.getAxisY(REC_BUTTON_WIDTH),
height: SizeUtil.getAxisY(REC_BUTTON_HEIGHT),
decoration: new BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
colors: [
ProfileColors.COLOR_BLACK,
ProfileColors.COLOR_GREY,
],
),
borderRadius: new BorderRadius.circular(100.0),
),
child: Material(
color: Colors.transparent,
shape: RoundedRectangleBorder(
borderRadius:
new BorderRadius.circular(100.0),
),
child: InkWell(
onTap: () => debugPrint('Follow pressed'),
splashColor: ProfileColors.COLOR_GREY,
highlightColor: ProfileColors.COLOR_GREY,
borderRadius:
new BorderRadius.circular(100.0),
child: new Center(
child: new Text(
ProfileStrings.STRING_FOLLOW,
style: new TextStyle(
fontSize:
SizeUtil.getAxisBoth(TEXT_SIZE_M),
color: ProfileColors.COLOR_YELLOW,
),
),
),
),
),
)
],
),
SizedBox(height: 20.0),
Row(
children: <Widget>[
Text(
'Hristo Hristov',
style: TextStyle(
color: TEXT_BLACK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_XXL),
fontWeight: FontWeight.w300,
),
)
],
),
Row(
children: <Widget>[
Text(
'Frankfurt am main',
style: TextStyle(
color: TEXT_BLACK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_M),
fontWeight: FontWeight.w300,
),
),
Container(
width: 1.0,
height: 12,
color: TEXT_BLACK,
margin: EdgeInsets.only(left: 10, right: 10),
),
Text(
'Germany',
style: TextStyle(
color: TEXT_BLACK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_M),
fontWeight: FontWeight.w300,
),
)
],
),
],
),
),
_buildPhotos(),
Container(
padding: EdgeInsets.only(
left: 100, top: 30, right: 15, bottom: 30),
child: Text(
'Excepteur sint occacupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Excepteur sint occacupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
softWrap: true,
style: TextStyle(
color: TEXT_BLACK,
fontSize: SizeUtil.getAxisBoth(TEXT_SIZE_S),
height: 1.5),
),
),
],
),
),
_bottomBar()
],
),
),
body: Text("Profile page one"),
);
}
}
44 changes: 44 additions & 0 deletions lib/page/profile/profile_const.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
///
/// Created by Terrance Duong on 2019/01/03
/// Github: https://github.com/dndoanh
/// Email: dndoanh@gmail.com
///
import "package:flutter/material.dart";
class ProfileStrings {
static const STRING_NAME = "PROFILE";
static const STRING_FOLLOW = "FOLLOW";
static const STRING_PHOTOS = "photos";
}

class ProfileColors {
static const COLOR_BLACK = Color(0xFF010101);
static const COLOR_GREY = Color(0xFF424242);
static const COLOR_WHITE = Color(0xFFF7FFE3);
static const COLOR_DARK = Color(0xFF34323D);
static const COLOR_YELLOW = Color(0xFFF1EA94);
}

const CIRCLE_BUTTON_HEIGHT = 87.0;
const SQUARE_BUTTON_HEIGHT = 127.0;
const PHOTO_BUTTON_HEIGHT = 200.0;
const REC_BUTTON_WIDTH = 255.0;
const REC_BUTTON_HEIGHT = 96.0;
const TOP_BAR_HEIGHT = 152.0;
const TOP_BAR_GRADIENT_HEIGHT = 133.0;
const BOTTOM_BAR_HEIGHT = 200.0;

const TEXT_SIZE_XXL = 50.0;
const TEXT_SIZE_XL = 40.0;
const TEXT_SIZE_L = 28.0;
const TEXT_SIZE_M = 26.0;
const TEXT_SIZE_S = 24.0;

class ProfileImages {
static const IMAGE_PATH = "images/profile";
static const arrow_left = "$IMAGE_PATH/profile_arrow_left.png";
static const avatar = "$IMAGE_PATH/profile_avatar.png";
static const follow = "$IMAGE_PATH/profile_follow.png";
static const photos_01 = "$IMAGE_PATH/profile_photos_01.png";
static const photos_02 = "$IMAGE_PATH/profile_photos_02.png";
static const photos_03 = "$IMAGE_PATH/profile_photos_03.png";
}
Loading