forked from lohanidamodar/flutter_ui_challenges
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0331a6a
commit 307dc2d
Showing
2 changed files
with
252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
import 'package:cached_network_image/cached_network_image.dart'; | ||
/** | ||
* Author: Damodar Lohani | ||
* profile: https://github.com/lohanidamodar | ||
*/ | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_custom_clippers/flutter_custom_clippers.dart'; | ||
import 'package:flutter_ui_challenges/core/presentation/res/assets.dart'; | ||
|
||
class ProfileNinePage extends StatelessWidget { | ||
static final String path = "lib/src/pages/profile/profile9.dart"; | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text("Profile"), | ||
centerTitle: true, | ||
backgroundColor: Colors.transparent, | ||
elevation: 0, | ||
), | ||
extendBody: true, | ||
extendBodyBehindAppBar: true, | ||
body: Stack( | ||
children: [ | ||
ClipPath( | ||
clipper: OvalBottomBorderClipper(), | ||
child: Container( | ||
margin: const EdgeInsets.only(top: 30), | ||
height: 380, | ||
decoration: BoxDecoration( | ||
color: Colors.pink, | ||
), | ||
), | ||
), | ||
ClipPath( | ||
clipper: OvalBottomBorderClipper(), | ||
child: Container( | ||
height: 380, | ||
decoration: BoxDecoration( | ||
image: DecorationImage( | ||
image: CachedNetworkImageProvider(pancake), | ||
fit: BoxFit.cover), | ||
), | ||
foregroundDecoration: | ||
BoxDecoration(color: Colors.pink.withOpacity(0.8)), | ||
), | ||
), | ||
ListView( | ||
padding: const EdgeInsets.all(8.0), | ||
children: [ | ||
const SizedBox(height: 90), | ||
_buildAvatar(avatars[4]), | ||
const SizedBox(height: 10.0), | ||
Text( | ||
"Damodar Lohani", | ||
style: Theme.of(context) | ||
.textTheme | ||
.headline6 | ||
.copyWith(color: Colors.white), | ||
textAlign: TextAlign.center, | ||
), | ||
const SizedBox(height: 5.0), | ||
Text( | ||
"Flutter & Full Stack Developer", | ||
style: TextStyle( | ||
color: Colors.white70, | ||
), | ||
textAlign: TextAlign.center, | ||
), | ||
const SizedBox(height: 10.0), | ||
Card( | ||
color: Colors.white, | ||
elevation: 0, | ||
margin: const EdgeInsets.symmetric( | ||
vertical: 8.0, | ||
horizontal: 32.0, | ||
), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(10.0), | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Row( | ||
children: [ | ||
Expanded( | ||
child: Column( | ||
children: [ | ||
Text( | ||
"255K", | ||
style: Theme.of(context).textTheme.headline4, | ||
), | ||
const SizedBox(height: 10.0), | ||
Text( | ||
"Followers", | ||
style: Theme.of(context).textTheme.subtitle1, | ||
), | ||
], | ||
), | ||
), | ||
Expanded( | ||
child: Column( | ||
children: [ | ||
Text( | ||
"105K", | ||
style: Theme.of(context).textTheme.headline4, | ||
), | ||
const SizedBox(height: 10.0), | ||
Text( | ||
"Following", | ||
style: Theme.of(context).textTheme.subtitle1, | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
const SizedBox(height: 20.0), | ||
Text( | ||
"Favorite", | ||
style: Theme.of(context).textTheme.headline5, | ||
), | ||
const SizedBox(height: 10.0), | ||
SizedBox( | ||
height: 150, | ||
child: ListView( | ||
scrollDirection: Axis.horizontal, | ||
children: [ | ||
_buildFavoriteCard(context, "Design"), | ||
const SizedBox(width: 10.0), | ||
_buildFavoriteCard(context, "Fruits"), | ||
const SizedBox(width: 10.0), | ||
_buildFavoriteCard(context, "Nature"), | ||
const SizedBox(width: 10.0), | ||
], | ||
), | ||
), | ||
const SizedBox(height: 20.0), | ||
Text( | ||
"Friends", | ||
style: Theme.of(context).textTheme.headline5, | ||
), | ||
Container( | ||
height: 60, | ||
width: double.infinity, | ||
child: Stack( | ||
children: [ | ||
...avatars | ||
.asMap() | ||
.map( | ||
(i, e) => MapEntry( | ||
i, | ||
Transform.translate( | ||
offset: Offset(i * 30.0, 0), | ||
child: SizedBox(height: 60,width: 60,child: _buildAvatar(e, radius: 30)), | ||
), | ||
), | ||
) | ||
.values | ||
.toList(), | ||
], | ||
), | ||
) | ||
], | ||
) | ||
], | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
child: Icon(Icons.add), | ||
backgroundColor: Colors.red, | ||
onPressed: () {}, | ||
), | ||
); | ||
} | ||
|
||
CircleAvatar _buildAvatar(String image, {double radius = 80}) { | ||
return CircleAvatar( | ||
backgroundColor: Colors.white, | ||
radius: radius, | ||
child: CircleAvatar( | ||
radius: radius - 2, | ||
backgroundImage: CachedNetworkImageProvider(image), | ||
), | ||
); | ||
} | ||
|
||
Widget _buildFavoriteCard(BuildContext context, String title) { | ||
return Container( | ||
width: 150, | ||
height: 150, | ||
child: Stack( | ||
children: [ | ||
Container( | ||
decoration: BoxDecoration( | ||
color: Colors.blueAccent, | ||
borderRadius: BorderRadius.circular(10.0), | ||
), | ||
height: double.infinity, | ||
width: double.infinity, | ||
margin: const EdgeInsets.symmetric( | ||
horizontal: 8.0, | ||
), | ||
), | ||
Container( | ||
decoration: BoxDecoration( | ||
color: Colors.indigo, | ||
borderRadius: BorderRadius.circular(10.0), | ||
), | ||
height: double.infinity, | ||
width: double.infinity, | ||
margin: const EdgeInsets.symmetric( | ||
vertical: 8.0, | ||
horizontal: 4.0, | ||
), | ||
), | ||
Container( | ||
clipBehavior: Clip.antiAlias, | ||
alignment: Alignment.center, | ||
height: double.infinity, | ||
width: double.infinity, | ||
margin: const EdgeInsets.only(bottom: 16), | ||
decoration: BoxDecoration( | ||
image: DecorationImage( | ||
image: CachedNetworkImageProvider(images[0]), | ||
fit: BoxFit.cover), | ||
borderRadius: BorderRadius.circular(10.0)), | ||
foregroundDecoration: BoxDecoration( | ||
color: Colors.blue.withOpacity(0.3), | ||
borderRadius: BorderRadius.circular(10.0)), | ||
), | ||
Container( | ||
alignment: Alignment.center, | ||
height: double.infinity, | ||
width: double.infinity, | ||
margin: const EdgeInsets.only(bottom: 20), | ||
child: Text( | ||
title, | ||
style: Theme.of(context) | ||
.textTheme | ||
.headline6 | ||
.copyWith(color: Colors.white), | ||
), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |