Skip to content
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

updated task card UI #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
75 changes: 36 additions & 39 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:ten_thousand_hours/providers/task_list_provider.dart';
import 'package:ten_thousand_hours/providers/timer_provider.dart';
import 'package:ten_thousand_hours/view/screens/edit_taskname.dart';
import 'package:ten_thousand_hours/view/screens/splash_screen.dart';
import 'package:ten_thousand_hours/view/screens/onboarding_screen.dart';
import 'view/screens/add_task.dart';
import 'view/screens/timer_screen.dart';
import 'view/screens/splash_screen.dart';
import 'view/screens/home_screen.dart';

void main() {

runApp(MultiProvider(
providers: [
ChangeNotifierProvider(
create: (context) => TaskListProvider(),
),
ChangeNotifierProvider(
create: (context) => TimerProvider(),
)
],
child: MaterialApp(
title: "10,000 Hours",
initialRoute: SplashScreen.id,
routes: {
SplashScreen.id: (context) => const SplashScreen(),
OnboardingScreen.id: (context) => OnboardingScreen(),

SplashScreen.id: (context) => SplashScreen(),
EditTaskName.id: (context) => EditTaskName(),
HomeScreen.id: (context) => HomeScreen(),
AddTask.id: (context) => AddTask(),
TaskTimer.id: (context) => const TaskTimer(),
},
),
));
}

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:ten_thousand_hours/providers/task_list_provider.dart';
import 'package:ten_thousand_hours/providers/timer_provider.dart';
import 'package:ten_thousand_hours/view/screens/edit_taskname.dart';
import 'package:ten_thousand_hours/view/screens/splash_screen.dart';
import 'view/screens/add_task.dart';
import 'view/screens/timer_screen.dart';
import 'view/screens/home_screen.dart';

void main() {

runApp(MultiProvider(
providers: [
ChangeNotifierProvider(
create: (context) => TaskListProvider(),
),
ChangeNotifierProvider(
create: (context) => TimerProvider(),
)
],
child: MaterialApp(
title: "10,000 Hours",
initialRoute: splashScreen.id,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial route is the Onboarding screen

routes: {

splashScreen.id: (context) => splashScreen(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its SplashScreen and not splashScreen , please check the errors , also add the OnbaordingScreen .

EditTaskName.id: (context) => EditTaskName(),
HomeScreen.id: (context) => HomeScreen(),
AddTask.id: (context) => AddTask(),
TaskTimer.id: (context) => const TaskTimer(),
},
),
));
}
53 changes: 27 additions & 26 deletions lib/view/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,40 @@ class HomeScreenView extends StatelessWidget {
double width = MediaQuery.of(context).size.width;
double height= MediaQuery.of(context).size.height;
return Scaffold(
appBar: AppBar(
title: const Text("10-000 Hours"),
),
body: Padding(
padding: const EdgeInsets.fromLTRB(10, 25, 10, 10),
child: Column(
children: [
Expanded(
child: Consumer<TaskListProvider>(
builder: (context, provider, child) {
if (provider.getTaskList().isEmpty) {
return Container(margin: EdgeInsets.only(top:height/3 ),
child: Text(
"Please press the + button to create a Task",
style: TextStyle(fontSize: width / 21)),
);
}

appBar: AppBar(
title: const Text("10-000 Hours"),
),
body: Padding(
padding: const EdgeInsets.fromLTRB(10, 25, 10, 10),
child: Column(
children: [

Expanded(
child: Consumer<TaskListProvider>(
builder: (context, provider, child) {

return ListView.builder(
itemCount: provider.getTaskList().length,
itemBuilder: (BuildContext context, int index) {
return GestureDetector(
onTap: () => Navigator.pushNamed(
context, TaskTimer.id,
arguments: {'index': index}),
child: Container(padding: EdgeInsets.symmetric(vertical: 12),margin: EdgeInsets.only(bottom: 5),
color: Colors.blue.shade100,
child: Center(
child: Text(provider
.getTaskList()[index]
.getTaskName(),style: TextStyle(fontSize: 22)),),
),);
},
);

child: TaskCard(
taskName:
provider.getTaskList()[index].getTaskName(),
),
);
});
}),
),
CustomButton(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presently there is a Custom button and FloatingActionButton to do the same thing . Please choose one of the two.

buttonText: "add new skill",
buttonCta: () {
Navigator.pushNamed(context, AddTask.id);

},
),
),
Expand Down
35 changes: 24 additions & 11 deletions lib/view/widgets/task_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,34 @@ import 'package:flutter/material.dart';

class TaskCard extends StatelessWidget {
final String taskName;
final int colorCode;
const TaskCard({required this.taskName, required this.colorCode, Key? key})
: super(key: key);
const TaskCard({required this.taskName, Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.all(10),
height: 50,
color: Colors.grey[colorCode],
child: Center(
return ConstrainedBox(
constraints: BoxConstraints(
minHeight: 80,
),
child: Container(
decoration: BoxDecoration(
boxShadow: [BoxShadow(blurRadius: 3, color: Colors.grey)],
color: Colors.orangeAccent,
borderRadius: BorderRadius.circular(8),
),
margin: const EdgeInsets.all(10),
// height: 80.2,
width: 600,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 16, 8, 8),
child: Text(
taskName,
style: const TextStyle(color: Colors.white),
)),
taskName,
style: const TextStyle(
color: Color.fromARGB(255, 57, 57, 57),
fontSize: 16,
fontWeight: FontWeight.w400),
),
),
),
);
}
}