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
5bc3c4c
commit c02796f
Showing
4 changed files
with
271 additions
and
1 deletion.
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,267 @@ | ||
/** | ||
* Author: Damodar Lohani | ||
* profile: https://github.com/lohanidamodar | ||
*/ | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
final List<String> weekDays = ["S", "M", "T", "W", "T", "F", "S"]; | ||
final List<int> dates = [5, 6, 7, 8, 9, 10, 11]; | ||
|
||
class TodoTwoPage extends StatelessWidget { | ||
static final String path = "lib/src/pages/todo/todo2.dart"; | ||
final int selected = 5; | ||
final TextStyle selectedText = TextStyle( | ||
color: Colors.deepOrange, | ||
fontWeight: FontWeight.bold, | ||
); | ||
final TextStyle daysText = TextStyle( | ||
fontWeight: FontWeight.bold, | ||
color: Colors.grey.shade800, | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
brightness: Brightness.light, | ||
iconTheme: IconThemeData(color: Colors.black), | ||
title: Text('My Week'), | ||
backgroundColor: Colors.white, | ||
elevation: 0, | ||
), | ||
body: HeaderWidget( | ||
header: Container( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Padding( | ||
padding: const EdgeInsets.only(left: 16.0), | ||
child: Text( | ||
"January".toUpperCase(), | ||
style: TextStyle( | ||
color: Colors.grey.shade700, | ||
fontWeight: FontWeight.bold, | ||
fontSize: 16.0, | ||
letterSpacing: 2.0), | ||
), | ||
), | ||
Row( | ||
children: weekDays.map((w) { | ||
return Expanded( | ||
child: Container( | ||
alignment: Alignment.center, | ||
decoration: BoxDecoration( | ||
color: weekDays.indexOf(w) == selected | ||
? Colors.orange.shade100 | ||
: Colors.transparent, | ||
borderRadius: BorderRadius.vertical( | ||
top: Radius.circular(30.0))), | ||
padding: const EdgeInsets.only(top: 20, bottom: 8.0), | ||
child: Text( | ||
w, | ||
style: weekDays.indexOf(w) == selected | ||
? selectedText | ||
: daysText, | ||
), | ||
), | ||
); | ||
}).toList(), | ||
), | ||
Row( | ||
children: dates.map((d) { | ||
return Expanded( | ||
child: Container( | ||
alignment: Alignment.center, | ||
decoration: BoxDecoration( | ||
color: dates.indexOf(d) == selected | ||
? Colors.orange.shade100 | ||
: Colors.transparent, | ||
borderRadius: BorderRadius.vertical( | ||
bottom: Radius.circular(30.0))), | ||
padding: const EdgeInsets.only(top: 8.0, bottom: 20.0), | ||
child: Text("$d", | ||
style: dates.indexOf(d) == selected | ||
? selectedText | ||
: daysText), | ||
), | ||
); | ||
}).toList(), | ||
), | ||
const SizedBox(height: 10.0), | ||
], | ||
), | ||
), | ||
body: SingleChildScrollView( | ||
padding: const EdgeInsets.all(32.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
_buildTaskWithDate(), | ||
const SizedBox(height: 20.0), | ||
_buildTask(), | ||
const SizedBox(height: 20.0), | ||
_buildTask(), | ||
const SizedBox(height: 20.0), | ||
_buildTaskWithDate(), | ||
const SizedBox(height: 20.0), | ||
_buildTask(), | ||
const SizedBox(height: 20.0), | ||
_buildTask(), | ||
const SizedBox(height: 20.0), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Row _buildTaskWithDate() { | ||
return Row( | ||
children: <Widget>[ | ||
Text( | ||
"JAN\n10", | ||
textAlign: TextAlign.center, | ||
style: TextStyle( | ||
color: Colors.white, | ||
fontWeight: FontWeight.bold, | ||
letterSpacing: 1.5), | ||
), | ||
const SizedBox(width: 20.0), | ||
Expanded( | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.only( | ||
topLeft: Radius.circular(20.0), | ||
bottomRight: Radius.circular(20.0), | ||
bottomLeft: Radius.circular(20.0), | ||
), | ||
color: Colors.white70, | ||
), | ||
padding: const EdgeInsets.symmetric( | ||
horizontal: 32.0, vertical: 16.0), | ||
width: double.infinity, | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
"10:30 - 11:30AM", | ||
style: TextStyle( | ||
letterSpacing: 2.5, color: Colors.deepPurple), | ||
), | ||
const SizedBox(height: 5.0), | ||
Text( | ||
"Meeting With", | ||
style: TextStyle( | ||
fontWeight: FontWeight.bold, | ||
color: Colors.deepPurple, | ||
fontSize: 16.0), | ||
), | ||
Text("John Doe") | ||
], | ||
), | ||
), | ||
) | ||
], | ||
); | ||
} | ||
|
||
Container _buildTask() { | ||
return Container( | ||
padding: const EdgeInsets.only(left: 70.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: <Widget>[ | ||
Text( | ||
"10:30 - 11:30AM", | ||
style: | ||
TextStyle(letterSpacing: 2.5, color: Colors.white), | ||
), | ||
const SizedBox(height: 5.0), | ||
Text( | ||
"Meeting With", | ||
style: TextStyle( | ||
fontWeight: FontWeight.bold, | ||
color: Colors.white, | ||
fontSize: 16.0), | ||
), | ||
Text("John Doe") | ||
], | ||
), | ||
); | ||
} | ||
} | ||
|
||
class HeaderWidget extends StatelessWidget { | ||
final Widget body; | ||
final Widget header; | ||
final Color headerColor; | ||
final Color backColor; | ||
|
||
const HeaderWidget( | ||
{Key key, | ||
this.body, | ||
this.header, | ||
this.headerColor = Colors.white, | ||
this.backColor = Colors.deepPurple}) | ||
: super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return _buildBody(); | ||
} | ||
|
||
Stack _buildBody() { | ||
return Stack( | ||
children: <Widget>[ | ||
Positioned( | ||
right: 0, | ||
top: 0, | ||
width: 10, | ||
height: 200, | ||
child: DecoratedBox( | ||
decoration: BoxDecoration( | ||
color: backColor, | ||
borderRadius: | ||
BorderRadius.only(topLeft: Radius.circular(20.0))), | ||
), | ||
), | ||
Positioned( | ||
right: 0, | ||
top: 100, | ||
width: 50, | ||
bottom: 0, | ||
child: DecoratedBox( | ||
decoration: BoxDecoration( | ||
color: backColor, | ||
), | ||
), | ||
), | ||
Column( | ||
children: <Widget>[ | ||
if (header != null) | ||
Container( | ||
margin: const EdgeInsets.only(right: 10.0), | ||
decoration: BoxDecoration( | ||
borderRadius: | ||
BorderRadius.only(bottomRight: Radius.circular(20.0)), | ||
color: headerColor, | ||
), | ||
child: header), | ||
if (body != null) | ||
Expanded( | ||
child: Material( | ||
shape: RoundedRectangleBorder( | ||
borderRadius: | ||
BorderRadius.only(topLeft: Radius.circular(30.0))), | ||
elevation: 0, | ||
color: backColor, | ||
child: body), | ||
), | ||
], | ||
), | ||
], | ||
); | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.