Skip to content

Commit

Permalink
todo week view
Browse files Browse the repository at this point in the history
  • Loading branch information
lohanidamodar committed Aug 1, 2019
1 parent 5bc3c4c commit c02796f
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ The code for Springy Widget is taken and refactored from (https://github.com/mat

## Todo App

<img height="480px" src="screenshots/todohome1.png">
<img height="480px" src="screenshots/todo2.png"> <img height="480px" src="screenshots/todohome1.png">

## Hotel App

Expand Down
267 changes: 267 additions & 0 deletions lib/src/pages/todo/todo2.dart
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),
),
],
),
],
);
}
}
3 changes: 3 additions & 0 deletions lib/src/widgets/main_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import 'package:flutter_ui_challenges/src/pages/quiz_app/demo_values.dart';
import 'package:flutter_ui_challenges/src/pages/quiz_app/home.dart';
import 'package:flutter_ui_challenges/src/pages/quiz_app/quiz_finished.dart';
import 'package:flutter_ui_challenges/src/pages/quiz_app/quiz_page.dart';
import 'package:flutter_ui_challenges/src/pages/todo/todo2.dart';
import 'package:flutter_ui_challenges/src/pages/todo/todo_home1.dart';
import 'package:flutter_ui_challenges/src/pages/travel/tdestination.dart';
import 'package:flutter_ui_challenges/src/utils/constants.dart';
Expand Down Expand Up @@ -181,6 +182,8 @@ class _MainMenuState extends State<MainMenu> {
path: CheckAnswersPage.path),
]),
MenuItem(title: "Todo", icon: FontAwesomeIcons.tasks, items: [
SubMenuItem("Todo Week View", TodoTwoPage(),
path: TodoTwoPage.path),
SubMenuItem("Todo Home One", TodoHomeOnePage(),
path: TodoHomeOnePage.path),
]),
Expand Down
Binary file added screenshots/todo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c02796f

Please sign in to comment.