Skip to content

Commit b2d2985

Browse files
committed
added providers and ui elements
1 parent ea58fd4 commit b2d2985

File tree

18 files changed

+146
-22
lines changed

18 files changed

+146
-22
lines changed

lib/app/modules/authentication/presentation/pages/authentication_page.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import 'package:app/app/widgets/primary_button.dart';
2-
import 'package:app/core/common/image_paths.dart';
3-
import 'package:app/core/routes/app_paths.dart';
4-
import 'package:app/core/theme/app_theme.dart';
1+
import '../../../../widgets/primary_button.dart';
2+
import '../../../../../core/common/image_paths.dart';
3+
import '../../../../../core/routes/app_paths.dart';
4+
import '../../../../../core/theme/app_theme.dart';
55
import 'package:flutter/material.dart';
66

77
import '../../../../widgets/custom_text.dart';

lib/app/modules/home/presentation/pages/home_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import 'package:app/core/routes/app_paths.dart';
2-
import 'package:app/core/theme/app_theme.dart';
1+
import '../../../../../core/routes/app_paths.dart';
2+
import '../../../../../core/theme/app_theme.dart';
33
import 'package:flutter/material.dart';
44

55
import '../../../../widgets/custom_text.dart';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import 'package:flutter/material.dart';
2+
3+
class HomeProvider extends ChangeNotifier {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import '../../../../widgets/custom_text.dart';
2+
import '../../../../../core/theme/app_theme.dart';
3+
4+
import 'package:flutter/material.dart';
5+
6+
class DeleteTaskSnackbar extends SnackBar {
7+
const DeleteTaskSnackbar({super.key})
8+
: super(
9+
backgroundColor: AppTheme.tealGreen,
10+
duration: const Duration(seconds: 1),
11+
content: const CustomText(
12+
value: "Task has successfully deleted!",
13+
color: AppTheme.white,
14+
),
15+
);
16+
}

lib/app/modules/home/presentation/widgets/task_menu.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import 'package:app/app/widgets/custom_text.dart';
21
import 'package:flutter/material.dart';
32

43
import '../../../../../core/enums/todo_menu_enum.dart';
4+
import '../../../../../core/routes/app_paths.dart';
5+
import '../../../../widgets/component_functions.dart';
6+
import '../../../../widgets/custom_text.dart';
7+
import 'delete_task_snackbar.dart';
58

69
class TaskMenu extends StatelessWidget {
710
const TaskMenu({super.key});
@@ -21,7 +24,12 @@ class TaskMenu extends StatelessWidget {
2124
),
2225
],
2326
onSelected: (String value) {
24-
// print('Selected option: $value');
27+
if (value == TodoMenuEnum.edit.name) {
28+
Navigator.pushNamed(context, AppPaths.todo);
29+
} else if (value == TodoMenuEnum.delete.name) {
30+
ComponentFunctions.hanleSnackBar(
31+
context: context, snakbar: const DeleteTaskSnackbar());
32+
}
2533
},
2634
icon: const Icon(Icons.more_vert),
2735
);

lib/app/modules/home/presentation/widgets/task_tile.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import 'package:app/app/modules/home/presentation/widgets/task_menu.dart';
2-
import 'package:app/app/widgets/custom_text.dart';
3-
import 'package:app/core/theme/app_theme.dart';
1+
import 'task_menu.dart';
2+
import '../../../../widgets/custom_text.dart';
3+
import '../../../../../core/theme/app_theme.dart';
44
import 'package:flutter/material.dart';
55

66
class TaskTile extends StatelessWidget {
@@ -24,6 +24,8 @@ class TaskTile extends StatelessWidget {
2424
child: CustomText(
2525
value: "Shopping Grocery",
2626
fontWeight: FontWeight.bold,
27+
maxLine: 2,
28+
textOverflow: TextOverflow.ellipsis,
2729
),
2830
)),
2931
TaskMenu()

lib/app/modules/profile/presentation/pages/profile_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:app/app/widgets/custom_text.dart';
1+
import '../../../../widgets/custom_text.dart';
22

33
import 'package:flutter/material.dart';
44

lib/app/modules/todo/presentation/pages/todo_page.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import 'package:app/app/widgets/custom_date_picker.dart';
2-
import 'package:app/app/widgets/custom_text.dart';
1+
import '../../../../widgets/custom_date_picker.dart';
2+
import '../../../../widgets/custom_text.dart';
33
import 'package:flutter/material.dart';
44

55
import '../../../../../core/theme/app_theme.dart';
@@ -25,6 +25,7 @@ class TodoPage extends StatelessWidget {
2525
child: Column(
2626
children: [
2727
TextField(
28+
textInputAction: TextInputAction.done,
2829
decoration: InputDecoration(
2930
hintText: "Provide a name..",
3031
hintStyle: Theme.of(context).textTheme.body.copyWith(),
@@ -41,6 +42,7 @@ class TodoPage extends StatelessWidget {
4142
Padding(
4243
padding: const EdgeInsets.symmetric(vertical: 20),
4344
child: TextField(
45+
textInputAction: TextInputAction.done,
4446
maxLines: 6,
4547
decoration: InputDecoration(
4648
hintText: "Enter the description..",
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import 'package:flutter/material.dart';
2+
3+
final class ComponentFunctions {
4+
static void hanleSnackBar(
5+
{required BuildContext context, required SnackBar snakbar}) {
6+
ScaffoldMessenger.of(context)
7+
..hideCurrentSnackBar()
8+
..showSnackBar(snakbar);
9+
}
10+
}

lib/app/widgets/custom_date_picker.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class _CustomDatePickerState extends State<CustomDatePicker> {
1212
final currentDate = DateTime.now();
1313
final lastDate = DateTime(2100);
1414

15-
Future<void> _selectDate(BuildContext context) async {
15+
Future<void> handleSelectDate() async {
1616
final picked = await showDatePicker(
1717
context: context,
1818
initialDate: currentDate,
@@ -28,7 +28,7 @@ class _CustomDatePickerState extends State<CustomDatePicker> {
2828
@override
2929
Widget build(BuildContext context) {
3030
return TextButton(
31-
onPressed: () => _selectDate(context),
31+
onPressed: handleSelectDate,
3232
child: const Icon(Icons.add),
3333
);
3434
}

0 commit comments

Comments
 (0)