repo_id
stringlengths 21
168
| file_path
stringlengths 36
210
| content
stringlengths 1
9.98M
| __index_level_0__
int64 0
0
|
---|---|---|---|
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen/task_form_screen.dart | import 'package:day_night_time_picker/day_night_time_picker.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:todo_app/presentation/calendar_screen/model/calendar_model.dart';
import '../../core/utils/color_constant.dart';
import '../../core/utils/image_constant.dart';
import '../../core/utils/size_utils.dart';
import '../../theme/app_style.dart';
import '../../widgets/app_bar/custom_app_bar.dart';
import '../../widgets/custom_button.dart';
import '../../widgets/custom_image_view.dart';
import '../../widgets/custom_text_form_field.dart';
import '../../widgets/date_range_picker.dart';
import '../calendar_screen/calendar_screen.dart';
import 'controller/task_form_controller.dart';
class TaskFormScreen extends GetWidget<TaskFormController> {
@override
Widget build(BuildContext context) {
Time _time = Time(hour: 11, minute: 30, second: 20);
DateTime _today = DateTime.now();
final DateTime _selectedDay = _today;
EventModel eventModel = EventModel(time: _time, date: _selectedDay);
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: ColorConstant.gray50,
appBar: CustomAppBar(
height: getVerticalSize(49),
leadingWidth: 40,
leading: CustomImageView(
svgPath: ImageConstant.imgArrowleft,
height: getSize(24),
width: getSize(24),
margin: getMargin(left: 16, top: 12, bottom: 13),
onTap: () {
onTapImgArrowleft();
}),
centerTitle: true,
title: Text("Create New Task:".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold24)),
body: Container(
width: double.maxFinite,
padding: getPadding(left: 16, top: 27, right: 16, bottom: 27),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text("Title:".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16),
CustomTextFormField(
focusNode: FocusNode(),
controller: controller.taskNameController,
hintText: "Task name".tr,
)
]),
Padding(
padding: getPadding(top: 20),
child: Text("Description:".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16)),
CustomTextFormField(
focusNode: FocusNode(),
controller: controller.descriptionController,
hintText: "Write your task description.....".tr,
textInputAction: TextInputAction.done,
suffix: Container(
margin: getMargin(
left: 30, top: 30, right: 7, bottom: 7),
child: CustomImageView(
svgPath: ImageConstant.imgEdit)),
suffixConstraints:
BoxConstraints(maxHeight: getVerticalSize(190)),
maxLines: 4),
Spacer(),
GestureDetector(
onTap: () {
Get.to(() => CalendarScreen());
},
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius:
BorderRadius.all(Radius.circular(10))),
height: 50,
width: 350,
padding: EdgeInsets.all(8),
child: Row(
children: [
Text(
"Select the date and time : ",
style: TextStyle(
color: Colors.indigo, fontSize: 15),
),
SizedBox(
width: 20,
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius:
BorderRadius.all(Radius.circular(1))),
height: 30,
width: 80,
padding: EdgeInsets.all(8),
child: Text(
"${eventModel.date}/t at ${eventModel.time}"),
),
SizedBox(
width: 10,
),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius:
BorderRadius.all(Radius.circular(1))),
height: 30,
width: 50,
padding: EdgeInsets.all(8),
child:
Text("${eventModel.time.format(context)}"),
)
],
),
),
),
Spacer(),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius:
BorderRadius.all(Radius.circular(10))),
height: 150,
width: 350,
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Time period of your task : "),
Spacer(),
Spacer(),
LongTermTask(),
],
)),
Spacer(),
CustomButton(
onTap: () async {
// Show loading dialog
Get.dialog(
Center(
child: CircularProgressIndicator(),
),
barrierDismissible: false,
);
await Future.delayed(Duration(seconds: 2));
Get.back();
Get.defaultDialog(
title: 'Task Saved',
middleText:
'Your task has been successfully saved!',
textConfirm: 'OK',
confirm: ElevatedButton(
onPressed: () {
// Close the success dialog
Get.back();
},
child: Text(
'OK',
style: TextStyle(color: Colors.white),
),
),
);
},
height: getVerticalSize(50),
text: "Save My Task".tr,
margin: getMargin(bottom: 65)),
]))));
}
onTapImgArrowleft() {
Get.back();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen/models/task_form_model.dart | /// This class defines the variables used in the [adacana_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class TaskFormModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen/binding/task_form_binding.dart | import 'package:get/get.dart';
import '../controller/task_form_controller.dart';
/// A binding class for the AdacanaScreen.
///
/// This class ensures that the AdacanaController is created when the
/// AdacanaScreen is first loaded.
class TaskFormBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => TaskFormController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/add_task_form_screen/controller/task_form_controller.dart | import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../models/task_form_model.dart';
class TaskFormController extends GetxController {
TextEditingController taskNameController = TextEditingController();
TextEditingController descriptionController = TextEditingController();
Rx<TaskFormModel> TaskFormModelObj = TaskFormModel().obs;
@override
void onReady() {
super.onReady();
}
@override
void onClose() {
super.onClose();
taskNameController.dispose();
descriptionController.dispose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen/task_views_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/custom_button.dart';
import '../../theme/app_style.dart';
import 'controller/task_views_controller.dart';
class TaskViewsScreen extends GetWidget<TaskViewsController> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: DefaultTabController(
length: 4,
child: Scaffold(
backgroundColor: ColorConstant.gray50,
// appBar: CustomAppBar(
// bottom: const TabBar(
// tabs: [
// Tab(icon: Icon(Icons.directions_car)),
// Tab(icon: Icon(Icons.directions_transit)),
// Tab(icon: Icon(Icons.directions_bike)),
// ],
// ),
// height: getVerticalSize(53),
// leadingWidth: 40,
// leading: AppbarImage(
// height: getSize(24),
// width: getSize(24),
// svgPath: ImageConstant.imgArrowleft,
// margin: getMargin(left: 16, top: 12, bottom: 17),
// onTap: () {
// onTapArrowleft5();
// }),
// centerTitle: true,
// title: AppbarTitle(text: "Task Management"),
// actions: [
// AppbarImage(
// height: getSize(24),
// width: getSize(24),
// svgPath: ImageConstant.imgOverflowmenu1,
// margin:
// getMargin(left: 16, top: 12, right: 16, bottom: 17))
// ]),
appBar: AppBar(
centerTitle: true,
title: Text("Task Management"),
bottom: TabBar(
tabs: [
Text("All"),
Text("On going"),
Text("on Hold"),
Text("Finished"),
],
),
),
body: TabBarView(
children: <Widget>[allTab(), onGoing(), onHold(), completed()],
),
),
));
}
onTapArrowleft5() {
Get.back();
}
}
Widget allTab() {
return Container(
width: double.maxFinite,
padding: getPadding(left: 16, top: 33, right: 16, bottom: 33),
child: Column(mainAxisAlignment: MainAxisAlignment.start, children: [
// Container(
// height: getVerticalSize(39),
// width: getHorizontalSize(396),
// child: Stack(alignment: Alignment.bottomCenter, children: [
// Align(
// alignment: Alignment.center,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// width: getHorizontalSize(38),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Text("All",
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// style: AppStyle.txtGilroyMedium16),
// Padding(
// padding: getPadding(top: 18),
// child: SizedBox(
// width: getHorizontalSize(38),
// child: Divider(
// height: getVerticalSize(2),
// thickness: getVerticalSize(2),
// color: ColorConstant.blueA700)))
// ])),
// Padding(
// padding: getPadding(left: 34, top: 3, bottom: 16),
// child: Text("On going",
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// style: AppStyle.txtGilroyMedium16Bluegray400)),
// Padding(
// padding: getPadding(left: 44, top: 2, bottom: 18),
// child: Text("On hold",
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// style: AppStyle.txtGilroyMedium16Bluegray400)),
// Padding(
// padding: getPadding(left: 44, top: 3, bottom: 16),
// child: Text("Completed",
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// style: AppStyle.txtGilroyMedium16Bluegray400))
// ])),
// Align(
// alignment: Alignment.bottomCenter,
// child: Padding(
// padding: getPadding(bottom: 1),
// child: SizedBox(
// width: getHorizontalSize(396),
// child: Divider(
// height: getVerticalSize(1),
// thickness: getVerticalSize(1),
// color: ColorConstant.blueGray100))))
// ])),
Padding(
padding: getPadding(top: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: getPadding(top: 8, bottom: 3),
child: Text("Project_1",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium18)),
CustomButton(
height: getVerticalSize(34),
width: getHorizontalSize(56),
text: "Started",
padding: ButtonPadding.PaddingAll6)
])),
Padding(
padding: getPadding(top: 16),
child: Divider(
height: getVerticalSize(1),
thickness: getVerticalSize(1),
color: ColorConstant.blueGray100)),
Padding(
padding: getPadding(top: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: getPadding(top: 8, bottom: 3),
child: Text("Project_2",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium18)),
CustomButton(
height: getVerticalSize(34),
width: getHorizontalSize(97),
text: "Completed",
variant: ButtonVariant.FillGreen600,
padding: ButtonPadding.PaddingAll6)
])),
Padding(
padding: getPadding(top: 16),
child: Divider(
height: getVerticalSize(1),
thickness: getVerticalSize(1),
color: ColorConstant.blueGray100)),
Padding(
padding: getPadding(top: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: getPadding(top: 8, bottom: 3),
child: Text("Project_3",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium18)),
CustomButton(
height: getVerticalSize(34),
width: getHorizontalSize(56),
text: "Started",
padding: ButtonPadding.PaddingAll6)
])),
Padding(
padding: getPadding(top: 16),
child: Divider(
height: getVerticalSize(1),
thickness: getVerticalSize(1),
color: ColorConstant.blueGray100)),
Padding(
padding: getPadding(top: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: getPadding(top: 8, bottom: 3),
child: Text("Project_4",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium18)),
CustomButton(
height: getVerticalSize(34),
width: getHorizontalSize(97),
text: "Completed",
variant: ButtonVariant.FillGreen600,
padding: ButtonPadding.PaddingAll6)
])),
Padding(
padding: getPadding(top: 16),
child: Divider(
height: getVerticalSize(1),
thickness: getVerticalSize(1),
color: ColorConstant.blueGray100)),
Padding(
padding: getPadding(top: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: getPadding(top: 8, bottom: 3),
child: Text("Project_5",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium18)),
CustomButton(
height: getVerticalSize(34),
width: getHorizontalSize(56),
text: "Started",
padding: ButtonPadding.PaddingAll6)
])),
Spacer(),
CustomButton(
onTap: () {
Get.toNamed(AppRoutes.taskFormScreen);
},
height: getVerticalSize(50),
text: "Add Task ",
margin: getMargin(bottom: 56),
padding: ButtonPadding.PaddingAll15,
fontStyle: ButtonFontStyle.GilroyMedium16)
]));
}
Widget onGoing() {
return Container(
child: Center(
child: Text('On Going ....'),
));
}
Widget onHold() {
return Container(
child: Center(
child: Text('On Hold ....'),
));
}
Widget completed() {
return Container(
child: Center(
child: Text('Completed ....'),
));
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen/models/task_views_model.dart | class TaskViewsModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen/binding/task_views_binding.dart | import '../controller/task_views_controller.dart';
import 'package:get/get.dart';
class TaskViewsBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => TaskViewsController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_views_screen/controller/task_views_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/task_views_screen/models/task_views_model.dart';
class TaskViewsController extends GetxController {
Rx<TaskViewsModel> taskViewsModelObj = TaskViewsModel().obs;
@override
void onReady() {
super.onReady();
}
@override
void onClose() {
super.onClose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen/home_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'controller/home_controller.dart';
// ignore_for_file: must_be_immutable
class HomeScreen extends GetWidget<HomeController> {
const HomeScreen({Key? key})
: super(
key: key,
);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Container(
width: double.maxFinite,
padding: EdgeInsets.only(
left: 30.h,
top: 79.v,
right: 30.h,
),
child: Column(
children: [
_buildProfileDetails(),
SizedBox(height: 47.v),
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.personalityScreen);
},
child: _buildHomeOption()),
SizedBox(height: 13.v),
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.workTodayScreen);
},
child: _buildHomeOption1()),
SizedBox(height: 13.v),
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.settingsScreen);
},
child: _buildHomeOption2()),
SizedBox(height: 5.v),
],
),
),
),
);
}
/// Section Widget
Widget _buildProfileDetails() {
return Container(
margin: EdgeInsets.only(left: 4.h),
padding: EdgeInsets.symmetric(horizontal: 84.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomImageView(
imagePath: ImageConstant.imgProfileImage,
height: 139.adaptSize,
width: 139.adaptSize,
radius: BorderRadius.circular(
69.h,
),
),
SizedBox(height: 13.v),
Padding(
padding: EdgeInsets.only(left: 30.h),
child: Text(
"Gayatri Samal".tr,
style: theme.textTheme.labelMedium,
),
),
Padding(
padding: EdgeInsets.only(left: 12.h),
child: Text(
"Evyan Inspires".tr,
style: theme.textTheme.bodyLarge,
),
),
SizedBox(height: 15.v),
Padding(
padding: EdgeInsets.only(left: 18.h),
child: Text(
"msg_joined_6_month_ago".tr,
style: CustomTextStyles.bodySmallOnPrimary,
),
),
],
),
);
}
/// Section Widget
Widget _buildHomeOption() {
return Container(
margin: EdgeInsets.only(left: 4.h),
padding: EdgeInsets.symmetric(
horizontal: 28.h,
vertical: 16.v,
),
decoration: AppDecoration.fillSecondaryContainer.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder14,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgUser,
height: 18.v,
width: 20.h,
margin: EdgeInsets.symmetric(vertical: 4.v),
),
Spacer(
flex: 45,
),
Padding(
padding: EdgeInsets.only(top: 3.v),
child: Text(
"lbl_personality".tr,
style: CustomTextStyles.titleMediumSecondaryContainer,
),
),
Spacer(
flex: 54,
),
CustomImageView(
imagePath: ImageConstant.imgStroke1,
height: 6.v,
width: 5.h,
radius: BorderRadius.circular(
2.h,
),
margin: EdgeInsets.only(
top: 10.v,
right: 5.h,
bottom: 10.v,
),
),
],
),
);
}
/// Section Widget
Widget _buildHomeOption1() {
return Container(
margin: EdgeInsets.only(left: 4.h),
padding: EdgeInsets.symmetric(
horizontal: 28.h,
vertical: 16.v,
),
decoration: AppDecoration.fillDeepPurpleA.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder14,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgFile,
height: 20.v,
width: 17.h,
margin: EdgeInsets.only(
left: 3.h,
top: 3.v,
bottom: 3.v,
),
),
Spacer(
flex: 43,
),
Padding(
padding: EdgeInsets.only(top: 3.v),
child: Text(
"Add ToDo task".tr,
style: CustomTextStyles.titleMediumDeeppurpleA400,
),
),
Spacer(
flex: 56,
),
CustomImageView(
imagePath: ImageConstant.imgStroke1DeepPurpleA400,
height: 6.v,
width: 5.h,
radius: BorderRadius.circular(
2.h,
),
margin: EdgeInsets.symmetric(vertical: 10.v),
),
],
),
);
}
/// Section Widget
Widget _buildHomeOption2() {
return Container(
margin: EdgeInsets.only(left: 4.h),
padding: EdgeInsets.symmetric(
horizontal: 26.h,
vertical: 15.v,
),
decoration: AppDecoration.fillPrimary.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder14,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomImageView(
imagePath: ImageConstant.imgSearch,
height: 20.v,
width: 19.h,
margin: EdgeInsets.only(
left: 3.h,
top: 4.v,
bottom: 4.v,
),
),
Spacer(
flex: 45,
),
Padding(
padding: EdgeInsets.only(top: 4.v),
child: Text(
"lbl_setting".tr,
style: CustomTextStyles.titleMediumPrimary,
),
),
Spacer(
flex: 54,
),
CustomImageView(
imagePath: ImageConstant.imgStroke1Primary,
height: 6.v,
width: 5.h,
radius: BorderRadius.circular(
2.h,
),
margin: EdgeInsets.symmetric(vertical: 11.v),
),
],
),
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen/models/home_model.dart | /// This class defines the variables used in the [home_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class HomeModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen/binding/home_binding.dart | import '../controller/home_controller.dart';
import 'package:get/get.dart';
/// A binding class for the HomeScreen.
///
/// This class ensures that the HomeController is created when the
/// HomeScreen is first loaded.
class HomeBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => HomeController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/home_screen/controller/home_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/home_screen/models/home_model.dart';
/// A controller class for the HomeScreen.
///
/// This class manages the state of the HomeScreen, including the
/// current homeModelObj
class HomeController extends GetxController {
Rx<HomeModel> homeModelObj = HomeModel().obs;
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen/calendar_screen.dart | // import 'package:flutter/material.dart';
// import 'package:get/get.dart';
// import 'package:table_calendar/table_calendar.dart';
// import 'package:todo_app/presentation/calendar_screen/model/calendar_model.dart';
//
// import 'controller/event_controller.dart';
//
// class CalendarScreen extends GetWidget<EventController> {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// title: Text("TODO Calendar"),
// ),
// floatingActionButton: FloatingActionButton(
// onPressed: () {
// Get.dialog(
// AlertDialog(
// scrollable: true,
// title: const Text(
// 'Scheduled Event Name: ',
// style: TextStyle(fontSize: 15),
// ),
// content: Padding(
// padding: const EdgeInsets.all(6),
// child: TextField(
// controller: controller.eventController,
// ),
// ),
// actions: [
// ElevatedButton(
// onPressed: () {
// controller.events.addAll({
// controller.selectedDay!: [
// EventModel(title: controller.eventController.text)
// ]
// });
// Get.back;
// controller.selectedEvent.value =
// controller.getEventForDay(controller.selectedDay!);
// },
// // onPressed: () {
// // controller.events.addAll({
// // controller.selectedDay.value: [
// // EventModel(title: controller.eventController.text)
// // ]
// // });
// // Get.back();
// // controller.selectedEvent.value =
// // controller.getEventForDay(controller.selectedDay.value);
// // },
// child: const Text('Add'),
// ),
// ],
// ),
// );
// },
// child: const Icon(Icons.add),
// ),
// body: SizedBox(
// height: MediaQuery.of(context).size.height,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// const SizedBox(
// height: 50,
// ),
// const Text(
// 'Schedule your Appointment :',
// ),
// Text(
// controller.selectedDay.toString().split(' ')[0],
// ),
// Padding(
// padding: const EdgeInsets.all(16.0),
// child: TableCalendar(
// rowHeight: 60,
// eventLoader: controller.getEventForDay,
// daysOfWeekHeight: 25,
// selectedDayPredicate: (day) => isSameDay(day, controller.today),
// availableGestures: AvailableGestures.all,
// firstDay: DateTime.utc(2010, 10, 16),
// lastDay: DateTime.utc(2030, 3, 14),
// focusedDay: controller.today,
// onDaySelected: (day, focusday) {
// day = controller.today;
// focusday = controller.selectedDay!;
// controller.onDaySelected(day, focusday);
// },
// calendarStyle: CalendarStyle(
// selectedDecoration: BoxDecoration(
// color: Colors.blue, // Set the color for the selected day
// shape:
// BoxShape.circle, // You can change the shape if needed
// ),
// todayDecoration: BoxDecoration(
// color: Colors
// .green, // Set the color for the focused day (today)
// shape: BoxShape.circle,
// ),
// ),
// ),
// ),
// SizedBox(
// height: 30,
// ),
// Expanded(
// child: Obx(
// () => ListView.builder(
// itemCount: controller.selectedEvent.length,
// itemBuilder: (context, i) {
// final eventName = controller.selectedEvent[i];
//
// return Container(
// margin: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
// decoration: BoxDecoration(
// border: Border.all(),
// borderRadius: BorderRadius.circular(12),
// ),
// child: ListTile(
// onTap: () => print(" "),
// title: Text(
// "Scheduled Event: \t\t\t\t\t\t${eventName.title}",
// ),
// ),
// );
// },
// ),
// ),
// ),
// ],
// ),
// ),
// );
// }
// }
import 'package:day_night_time_picker/day_night_time_picker.dart';
import 'package:flutter/material.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/calendar_screen/model/calendar_model.dart';
class CalendarScreen extends StatefulWidget {
const CalendarScreen();
@override
State<CalendarScreen> createState() => _CalendarScreenState();
}
class _CalendarScreenState extends State<CalendarScreen> {
DateTime _today = DateTime.now();
DateTime? _selectedDay;
Map<DateTime, List<EventModel>> events = {};
ValueNotifier<List<EventModel>> selectedEvent = ValueNotifier([]);
TextEditingController eventController = new TextEditingController();
Time _time = Time(hour: 11, minute: 30, second: 20);
bool iosStyle = true;
void onTimeChanged(Time newTime) {
setState(() {
_time = newTime;
});
}
List<EventModel> getEventForDay(DateTime day) {
return events[day] ?? [];
}
@override
void initState() {
super.initState();
_selectedDay = _today;
selectedEvent = ValueNotifier(getEventForDay(_selectedDay!));
eventController.clear();
}
@override
void dispose() {
super.dispose();
}
void _onDaySelected(DateTime selectedDay, DateTime today) {
if (!isSameDay(_selectedDay, selectedDay)) {
setState(() {
_today = today;
_selectedDay = selectedDay;
selectedEvent.value = getEventForDay(_selectedDay!);
});
}
}
// void _onDateSelected (DateTime day, DateTime selectedDay) {
// setState(() {
// _today = day;
// });
// }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.indigo,
title: Text(
"Calendar ",
style: TextStyle(color: Colors.white),
),
leading: GestureDetector(
onTap: () {
Get.back();
},
child: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.white,
)),
),
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const SizedBox(
height: 10,
),
// const Text(
// 'Schedule your Calendar :',
// style: TextStyle(color: Colors.black, fontSize: 16.5),
// ),
SizedBox(
height: 15,
),
Container(
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius: BorderRadius.all(Radius.circular(1))),
height: 30,
width: 150,
padding: EdgeInsets.all(8),
child: Text(
_today.toString().split(' ')[0],
),
),
// SizedBox(
// height: 20,
// ),
// ElevatedButton(onPressed: () {}, child: Text('Calendar')),
Padding(
padding: const EdgeInsets.all(16.0),
child: TableCalendar(
rowHeight: 60,
eventLoader: getEventForDay,
daysOfWeekHeight: 25,
selectedDayPredicate: (day) => isSameDay(day, _today),
availableGestures: AvailableGestures.all,
firstDay: DateTime.utc(2010, 10, 16),
lastDay: DateTime.utc(2030, 3, 14),
focusedDay: _today,
onDaySelected: _onDaySelected,
),
),
SizedBox(
height: 30,
),
Text(
'Select your time:',
style: TextStyle(color: Colors.black, fontSize: 16.5),
),
TextButton(
onPressed: () {
Navigator.of(context).push(
showPicker(
context: context,
value: _time,
sunrise: TimeOfDay(hour: 6, minute: 0), // optional
sunset: TimeOfDay(hour: 18, minute: 0), // optional
duskSpanInMinutes: 120, // optional
onChange: onTimeChanged,
),
);
},
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius: BorderRadius.all(Radius.circular(10))),
height: 50,
width: 350,
padding: EdgeInsets.all(8),
child: Row(
children: [
Text(
"Open time picker: ",
style: TextStyle(color: Colors.black, fontSize: 15),
),
Spacer(),
Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius: BorderRadius.all(Radius.circular(1))),
height: 30,
width: 150,
padding: EdgeInsets.all(8),
child: Text("${_time}",
style: TextStyle(
color: Colors.indigo.shade900, fontSize: 13)),
)
],
),
),
),
SizedBox(height: 45),
ElevatedButton(
style: ButtonStyle(
fixedSize: MaterialStateProperty.all(Size(75, 35)),
maximumSize:
MaterialStateProperty.all(Size.fromHeight(100.0)),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
// Adjust the value of BorderRadius.circular to control the button's corner radius
))),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
scrollable: true,
title: const Text(
'Do you want to schedule on this date & Time :',
style: TextStyle(fontSize: 15),
),
content: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.black12),
borderRadius:
BorderRadius.all(Radius.circular(10))),
height: 60,
width: 350,
padding: EdgeInsets.all(8),
child: Column(
children: [
Text(
"Date:\t\t ${_today.toString().split(' ')[0]}},\nTime:\t\t ${_time}"),
],
),
),
actions: [
ElevatedButton(
onPressed: () {
events.addAll({
_selectedDay!: [
EventModel(
date: _selectedDay!, time: _time)
]
});
Navigator.of(context).pop();
Get.offNamed(AppRoutes.taskFormScreen);
// events.addAll({
// _selectedDay!: [
// EventModel(title: eventController.text, description: )
// ]
// });
// selectedEvent.value =
// getEventForDay(_selectedDay!);
},
child: Text(
'Add',
style: TextStyle(color: Colors.white),
))
],
);
});
},
child: Text("save", style: TextStyle(color: Colors.white))),
// Expanded(
// child: ValueListenableBuilder<List<EventModel>>(
// valueListenable: selectedEvent,
// builder: (context, value, _) {
// return ListView.builder(
// itemCount: value.length,
// itemBuilder: (context, i) {
// final eventName = value[i];
//
// return Container(
// margin: EdgeInsets.symmetric(
// horizontal: 12, vertical: 4),
// decoration: BoxDecoration(
// border: Border.all(),
// borderRadius: BorderRadius.circular(12)),
// child: ListTile(
// onTap: () => print(" "),
// title: Text(
// "TODO TASK : \t\t\t\t\t\t${eventName.title}"),
// ),
// );
// });
// }),
// )
],
),
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen/binding/calendar_event_binder.dart | import 'package:get/get.dart';
import 'package:todo_app/presentation/calendar_screen/controller/event_controller.dart';
class CalendarScreenBinding implements Bindings {
@override
void dependencies() {
Get.put<EventController>(EventController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen/model/calendar_model.dart | import 'package:day_night_time_picker/day_night_time_picker.dart';
class EventModel {
final DateTime date;
final Time time;
EventModel({required this.time, required this.date});
factory EventModel.fromJson(Map<String, dynamic> json) {
return EventModel(
date: json['date'],
time: json['time'],
);
}
Map<String, dynamic> toJson() {
return {'date': date, 'time': time};
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/calendar_screen/controller/event_controller.dart | import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:table_calendar/table_calendar.dart';
import '../model/calendar_model.dart';
class EventController extends GetxController {
TextEditingController eventController = TextEditingController();
DateTime today = DateTime.now();
DateTime? selectedDay;
Map<DateTime, List<EventModel>> events = {};
RxList<EventModel> selectedEvent = <EventModel>[].obs;
List<EventModel> getEventForDay(DateTime day) {
return events[day] ?? [];
}
void onDaySelected(DateTime today, DateTime selectedDay) {
if (selectedDay != null && !isSameDay(this.selectedDay!, selectedDay)) {
this.today = today;
this.selectedDay = selectedDay;
selectedEvent.value = getEventForDay(this.selectedDay!);
}
}
@override
void onInit() {
super.onInit();
selectedDay = today;
selectedEvent.value = getEventForDay(selectedDay!);
eventController.clear();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen/login_or_signup_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/custom_elevated_button.dart';
import 'package:todo_app/widgets/custom_icon_button.dart';
import 'controller/login_or_signup_controller.dart';
class LoginOrSignupScreen extends GetWidget<LoginOrSignupController> {
const LoginOrSignupScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: appTheme.gray5001,
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 32.h, vertical: 39.v),
child: Column(children: [
Padding(
padding: EdgeInsets.only(left: 17.h),
child: CustomIconButton(
height: 24.adaptSize,
width: 24.adaptSize,
padding: EdgeInsets.all(6.h),
alignment: Alignment.centerLeft,
onTap: () {
onTapBtnArrowLeft();
},
child: CustomImageView(
imagePath: ImageConstant.imgArrowLeft))),
SizedBox(height: 41.v),
_buildPageHeader(),
SizedBox(height: 30.v),
CustomImageView(
imagePath: ImageConstant.imgLogoGray5001,
height: 105.v,
width: 117.h),
SizedBox(height: 33.v),
Text("lbl_get_in_through".tr,
style: theme.textTheme.titleMedium),
SizedBox(height: 33.v),
CustomElevatedButton(
text: "lbl_sign_up".tr,
onPressed: () {
onTapSignUp();
}),
SizedBox(height: 14.v),
CustomElevatedButton(
text: "lbl_login".tr,
buttonStyle: CustomButtonStyles.fillDeepOrange,
buttonTextStyle:
CustomTextStyles.titleSmallSecondaryContainer,
onPressed: () {
onTapLogin();
}),
SizedBox(height: 5.v)
]))));
}
/// Section Widget
Widget _buildPageHeader() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
width: 250.h,
child: Text("Welcome to our \nevyan community... ".tr,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.displaySmall!.copyWith(height: 1.18))),
SizedBox(height: 2.v),
Container(
width: 281.h,
margin: EdgeInsets.only(right: 29.h),
child: Text("msg_our_community_is".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.bodySmall!.copyWith(height: 1.67)))
]);
}
/// Navigates to the previous screen.
onTapBtnArrowLeft() {
Get.back();
}
/// Navigates to the signupScreen when the action is triggered.
onTapSignUp() {
Get.toNamed(
AppRoutes.signupScreen,
);
}
/// Navigates to the loginScreen when the action is triggered.
onTapLogin() {
Get.toNamed(
AppRoutes.loginScreen,
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen/models/login_or_signup_model.dart | /// This class defines the variables used in the [login_or_signup_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class LoginOrSignupModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen/binding/login_or_signup_binding.dart | import '../controller/login_or_signup_controller.dart';
import 'package:get/get.dart';
/// A binding class for the LoginOrSignupScreen.
///
/// This class ensures that the LoginOrSignupController is created when the
/// LoginOrSignupScreen is first loaded.
class LoginOrSignupBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => LoginOrSignupController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_or_signup_screen/controller/login_or_signup_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/login_or_signup_screen/models/login_or_signup_model.dart';
/// A controller class for the LoginOrSignupScreen.
///
/// This class manages the state of the LoginOrSignupScreen, including the
/// current loginOrSignupModelObj
class LoginOrSignupController extends GetxController {
Rx<LoginOrSignupModel> loginOrSignupModelObj = LoginOrSignupModel().obs;
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen/scheduling_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/app_bar/appbar_image.dart';
import 'package:todo_app/widgets/app_bar/appbar_title.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import 'package:todo_app/widgets/custom_button.dart';
import '../../theme/app_style.dart';
import '../scheduling_screen/widgets/scheduling_item_widget.dart';
import 'controller/scheduling_controller.dart';
import 'models/scheduling_item_model.dart';
class SchedulingScreen extends GetWidget<SchedulingController> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: ColorConstant.gray50,
appBar: CustomAppBar(
height: getVerticalSize(48),
leadingWidth: 40,
leading: AppbarImage(
height: getSize(24),
width: getSize(24),
svgPath: ImageConstant.imgArrowleft,
margin: getMargin(left: 16, top: 12, bottom: 12),
onTap: () {
onTapArrowleft();
}),
centerTitle: true,
title: AppbarTitle(text: "lbl_schedule".tr)),
body: Container(
width: double.maxFinite,
padding: getPadding(left: 16, top: 34, right: 16, bottom: 34),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("lbl_24".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold44),
Container(
width: getHorizontalSize(60),
margin: getMargin(
left: 12, top: 7, bottom: 6),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_wed".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroyMedium14),
Padding(
padding: getPadding(top: 4),
child: Text("lbl_jan_2020".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroyMedium14))
]))
]),
CustomButton(
height: getVerticalSize(40),
width: getHorizontalSize(83),
text: "lbl_today".tr,
margin: getMargin(top: 7, bottom: 5),
variant: ButtonVariant.FillBlueA70063,
padding: ButtonPadding.PaddingAll6,
fontStyle: ButtonFontStyle.GilroySemiBold18)
]),
Padding(
padding: getPadding(left: 1, top: 22, right: 3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: getPadding(top: 10, bottom: 3),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_s".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold12),
Padding(
padding: getPadding(top: 5),
child: Text("lbl_21".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))
])),
Padding(
padding: getPadding(top: 10, bottom: 3),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_m".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold12),
Padding(
padding: getPadding(top: 5),
child: Text("lbl_22".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))
])),
Padding(
padding: getPadding(top: 10, bottom: 3),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_t".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold12),
Padding(
padding: getPadding(top: 5),
child: Text("lbl_23".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))
])),
Container(
padding: getPadding(
left: 14, top: 6, right: 14, bottom: 6),
decoration: AppDecoration.fillBlueA700
.copyWith(
borderRadius: BorderRadiusStyle
.roundedBorder10),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Padding(
padding: getPadding(left: 2),
child: Text("lbl_w".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold12WhiteA700)),
Padding(
padding:
getPadding(top: 5, bottom: 1),
child: Text("lbl_242".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16WhiteA700))
])),
Padding(
padding: getPadding(top: 10, bottom: 3),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_t".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold12),
Padding(
padding: getPadding(top: 5),
child: Text("lbl_25".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))
])),
Padding(
padding: getPadding(top: 10, bottom: 3),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_f".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold12),
Padding(
padding: getPadding(top: 5),
child: Text("lbl_26".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))
])),
Padding(
padding: getPadding(top: 10, bottom: 3),
child: Column(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_s".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold12),
Padding(
padding: getPadding(top: 5),
child: Text("lbl_27".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))
]))
])),
Padding(
padding: getPadding(top: 26, bottom: 5),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: getPadding(top: 5, bottom: 188),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_time".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style:
AppStyle.txtGilroySemiBold14),
Align(
alignment: Alignment.center,
child: Padding(
padding: getPadding(top: 22),
child: Text("lbl_11_35".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))),
Align(
alignment: Alignment.centerRight,
child: Padding(
padding: getPadding(top: 8),
child: Text("lbl_13_05".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold14))),
Align(
alignment: Alignment.center,
child: Padding(
padding: getPadding(top: 107),
child: Text("lbl_13_15".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))),
Align(
alignment: Alignment.centerRight,
child: Padding(
padding: getPadding(top: 8),
child: Text("lbl_14_45".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold14))),
Align(
alignment: Alignment.center,
child: Padding(
padding: getPadding(top: 107),
child: Text("lbl_15_10".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16))),
Align(
alignment: Alignment.center,
child: Padding(
padding: getPadding(top: 8),
child: Text("lbl_16_40".tr,
overflow:
TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold14)))
])),
SizedBox(
height: getVerticalSize(585),
child: VerticalDivider(
width: getHorizontalSize(2),
thickness: getVerticalSize(2),
color: ColorConstant.blue200,
indent: getHorizontalSize(43))),
Container(
height: getVerticalSize(486),
width: getHorizontalSize(327),
margin: getMargin(bottom: 99),
child: Stack(
alignment: Alignment.center,
children: [
CustomImageView(
svgPath: ImageConstant.imgSort,
height: getSize(24),
width: getSize(24),
alignment: Alignment.topRight),
Align(
alignment: Alignment.center,
child: Column(
mainAxisSize:
MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text("lbl_course".tr,
overflow: TextOverflow
.ellipsis,
textAlign:
TextAlign.left,
style: AppStyle
.txtGilroySemiBold14),
Padding(
padding:
getPadding(top: 20),
child: Obx(() =>
ListView.separated(
physics:
NeverScrollableScrollPhysics(),
shrinkWrap:
true,
separatorBuilder:
(context,
index) {
return SizedBox(
height:
getVerticalSize(
16));
},
itemCount: controller
.schedulingModelObj
.value
.schedulingItemList
.value
.length,
itemBuilder:
(context,
index) {
SchedulingItemModel
model =
controller
.schedulingModelObj
.value
.schedulingItemList
.value[index];
return SchedulingItemWidget(
model);
})))
]))
]))
]))
]))));
}
onTapArrowleft() {
Get.back();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen/widgets/scheduling_item_widget.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import '../../../theme/app_style.dart';
import '../controller/scheduling_controller.dart';
import '../models/scheduling_item_model.dart';
// ignore: must_be_immutable
class SchedulingItemWidget extends StatelessWidget {
SchedulingItemWidget(this.schedulingItemModelObj);
SchedulingItemModel schedulingItemModelObj;
var controller = Get.find<SchedulingController>();
@override
Widget build(BuildContext context) {
return Container(
width: double.maxFinite,
child: Container(
padding: getPadding(
left: 12,
top: 16,
right: 12,
bottom: 16,
),
decoration: AppDecoration.fillBlueA700.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder6,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: getPadding(
left: 8,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: getPadding(
top: 2,
bottom: 1,
),
child: Obx(
() => Text(
schedulingItemModelObj.mathematicsTxt.value,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold16WhiteA700,
),
),
),
CustomImageView(
svgPath: ImageConstant.imgOverflowmenu,
height: getSize(
24,
),
width: getSize(
24,
),
),
],
),
),
Padding(
padding: getPadding(
left: 8,
top: 7,
),
child: Obx(
() => Text(
schedulingItemModelObj.chapter1IntroductionTxt.value,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium12,
),
),
),
Padding(
padding: getPadding(
left: 8,
top: 15,
),
child: Row(
children: [
CustomImageView(
svgPath: ImageConstant.imgLocation,
height: getSize(
16,
),
width: getSize(
16,
),
),
Padding(
padding: getPadding(
left: 16,
),
child: Obx(
() => Text(
schedulingItemModelObj.room6205Txt.value,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium12,
),
),
),
],
),
),
Padding(
padding: getPadding(
left: 8,
top: 8,
),
child: Row(
children: [
CustomImageView(
imagePath: ImageConstant.imgEllipse316x16,
height: getSize(
16,
),
width: getSize(
16,
),
radius: BorderRadius.circular(
getHorizontalSize(
8,
),
),
margin: getMargin(
bottom: 1,
),
),
Padding(
padding: getPadding(
left: 16,
),
child: Obx(
() => Text(
schedulingItemModelObj.schoolnameTxt.value,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtPoppinsRegular12,
),
),
),
],
),
),
],
),
),
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen/models/scheduling_item_model.dart | import 'package:get/get.dart';
class SchedulingItemModel {
Rx<String> mathematicsTxt = Rx("Mathematics");
Rx<String> chapter1IntroductionTxt = Rx("Chapter 1: Introduction");
Rx<String> room6205Txt = Rx("Room 6-205");
Rx<String> schoolnameTxt = Rx("Brooklyn Williamson");
Rx<String>? id = Rx("");
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen/models/scheduling_model.dart | import 'package:get/get.dart';
import 'scheduling_item_model.dart';
class SchedulingModel {
Rx<List<SchedulingItemModel>> schedulingItemList =
Rx(List.generate(3, (index) => SchedulingItemModel()));
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen/binding/scheduling_binding.dart | import '../controller/scheduling_controller.dart';
import 'package:get/get.dart';
class SchedulingBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => SchedulingController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/scheduling_screen/controller/scheduling_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/scheduling_screen/models/scheduling_model.dart';
class SchedulingController extends GetxController {
Rx<SchedulingModel> schedulingModelObj = SchedulingModel().obs;
@override
void onReady() {
super.onReady();
}
@override
void onClose() {
super.onClose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen/personality_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/app_bar/appbar_leading_iconbutton.dart';
import 'package:todo_app/widgets/app_bar/appbar_title.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import 'package:todo_app/widgets/custom_elevated_button.dart';
import 'package:todo_app/widgets/custom_text_form_field.dart';
import 'controller/personality_controller.dart';
class PersonalityScreen extends GetWidget<PersonalityController> {
const PersonalityScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Get.focusScope!.unfocus();
},
child: SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(),
body: SizedBox(
width: SizeUtils.width,
child: SingleChildScrollView(
padding: EdgeInsets.only(top: 19.v),
child: Padding(
padding: EdgeInsets.only(
left: 32.h, right: 32.h, bottom: 5.v),
child: Column(children: [
_buildEditProfilePic(),
SizedBox(height: 50.v),
_buildUserName(),
SizedBox(height: 18.v),
_buildFirstName(),
SizedBox(height: 18.v),
_buildLastName(),
SizedBox(height: 20.v),
_buildHobby(),
SizedBox(height: 18.v),
_buildDateOfBirth(),
SizedBox(height: 20.v),
_buildCountry(),
SizedBox(height: 34.v),
CustomElevatedButton(
text: "lbl_change_save".tr,
buttonTextStyle:
CustomTextStyles.titleMediumWhiteA700,
onPressed: () {
onTapChangeSave();
}),
SizedBox(height: 64.v),
])))))),
);
}
/// Section Widget
PreferredSizeWidget _buildAppBar() {
return CustomAppBar(
leadingWidth: 56.h,
leading: AppbarLeadingIconbutton(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 32.h, top: 14.v, bottom: 17.v),
onTap: () {
onTapArrowLeft();
}),
actions: [
AppbarTitle(
text: "lbl_personality".tr,
margin: EdgeInsets.symmetric(horizontal: 32.h, vertical: 14.v))
]);
}
/// Section Widget
Widget _buildEditProfilePic() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 86.h),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
CustomImageView(
imagePath: ImageConstant.imgProfileImage,
height: 139.adaptSize,
width: 139.adaptSize,
radius: BorderRadius.circular(69.h)),
SizedBox(height: 18.v),
Opacity(
opacity: 0.8,
child: Padding(
padding: EdgeInsets.only(left: 35.h),
child: Text("lbl_edit_photo".tr,
style: CustomTextStyles.labelLargeSecondaryContainer_1)))
]));
}
/// Section Widget
Widget _buildUserName() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_username".tr, style: theme.textTheme.labelLarge),
SizedBox(height: 13.v),
CustomTextFormField(
controller: controller.userNameController,
hintText: "Evyan Inspires".tr,
hintStyle: CustomTextStyles.titleSmallOnPrimary_1)
]);
}
/// Section Widget
Widget _buildFirstName() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_first_name2".tr, style: theme.textTheme.labelLarge),
SizedBox(height: 13.v),
CustomTextFormField(
controller: controller.firstNameController,
hintText: "Gayatri".tr,
hintStyle: CustomTextStyles.titleSmallOnPrimary_1)
]);
}
/// Section Widget
Widget _buildLastName() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_last_name2".tr, style: theme.textTheme.labelLarge),
SizedBox(height: 13.v),
CustomTextFormField(
controller: controller.lastNameController,
hintText: "Samal".tr,
hintStyle: CustomTextStyles.titleSmallOnPrimary_1)
]);
}
/// Section Widget
Widget _buildHobby() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_hobby".tr, style: theme.textTheme.labelLarge),
SizedBox(height: 11.v),
CustomTextFormField(
controller: controller.hobbyController,
hintText: "Build Apps".tr,
hintStyle: CustomTextStyles.titleSmallOnPrimary_1)
]);
}
/// Section Widget
Widget _buildDateOfBirth() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_date_of_birth".tr, style: theme.textTheme.labelLarge),
SizedBox(height: 13.v),
CustomTextFormField(
controller: controller.dateOfBirthController,
hintText: "25/2/2002".tr,
hintStyle: CustomTextStyles.titleSmallOnPrimary_1)
]);
}
/// Section Widget
Widget _buildCountry() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_country".tr, style: theme.textTheme.labelLarge),
SizedBox(height: 11.v),
CustomTextFormField(
controller: controller.countryController,
hintText: "India".tr,
hintStyle: CustomTextStyles.titleSmallOnPrimary_1,
textInputAction: TextInputAction.done)
]);
}
/// Navigates to the previous screen.
onTapArrowLeft() {
Get.back();
}
/// Navigates to the signupScreen when the action is triggered.
onTapChangeSave() {
// Get.toNamed(
// AppRoutes.signupScreen,
// );
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen/models/personality_model.dart | /// This class defines the variables used in the [personality_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class PersonalityModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen/binding/personality_binding.dart | import '../controller/personality_controller.dart';
import 'package:get/get.dart';
/// A binding class for the PersonalityScreen.
///
/// This class ensures that the PersonalityController is created when the
/// PersonalityScreen is first loaded.
class PersonalityBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => PersonalityController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/personality_screen/controller/personality_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/personality_screen/models/personality_model.dart';
import 'package:flutter/material.dart';
/// A controller class for the PersonalityScreen.
///
/// This class manages the state of the PersonalityScreen, including the
/// current personalityModelObj
class PersonalityController extends GetxController {
TextEditingController userNameController = TextEditingController();
TextEditingController firstNameController = TextEditingController();
TextEditingController lastNameController = TextEditingController();
TextEditingController hobbyController = TextEditingController();
TextEditingController dateOfBirthController = TextEditingController();
TextEditingController countryController = TextEditingController();
Rx<PersonalityModel> personalityModelObj = PersonalityModel().obs;
@override
void onClose() {
super.onClose();
userNameController.dispose();
firstNameController.dispose();
lastNameController.dispose();
hobbyController.dispose();
dateOfBirthController.dispose();
countryController.dispose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen/login_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/core/utils/validation_functions.dart';
import 'package:todo_app/widgets/app_bar/appbar_leading_iconbutton.dart';
import 'package:todo_app/widgets/app_bar/appbar_title.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import 'package:todo_app/widgets/custom_elevated_button.dart';
import 'package:todo_app/widgets/custom_text_form_field.dart';
import 'controller/login_controller.dart';
// ignore_for_file: must_be_immutable
class LoginScreen extends GetWidget<LoginController> {
LoginScreen({Key? key}) : super(key: key);
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Get.focusScope!.unfocus();
},
child: SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(),
body: Form(
key: _formKey,
child: SingleChildScrollView(
padding: EdgeInsets.only(top: 11.v),
child: Padding(
padding: EdgeInsets.only(
left: 32.h, right: 32.h, bottom: 5.v),
child: Column(children: [
_buildPageHeader(),
SizedBox(height: 21.v),
CustomImageView(
imagePath: ImageConstant.imgLogoGray5001113x116,
height: 113.v,
width: 116.h),
SizedBox(height: 45.v),
CustomTextFormField(
controller: controller.emailController,
hintText: "lbl_email2".tr,
textInputType: TextInputType.emailAddress,
validator: (value) {
if (value == null ||
(!isValidEmail(value,
isRequired: true))) {
return "err_msg_please_enter_valid_email"
.tr;
}
return null;
},
borderDecoration: TextFormFieldStyleHelper
.outlineOnPrimaryTL14),
SizedBox(height: 24.v),
CustomTextFormField(
controller: controller.passwordController,
hintText: "lbl_password".tr,
textInputAction: TextInputAction.done,
textInputType: TextInputType.visiblePassword,
validator: (value) {
if (value == null ||
(!isValidPassword(value,
isRequired: true))) {
return "err_msg_please_enter_valid_password"
.tr;
}
return null;
},
obscureText: true,
borderDecoration: TextFormFieldStyleHelper
.outlineOnPrimaryTL14),
SizedBox(height: 26.v),
Align(
alignment: Alignment.centerLeft,
child: GestureDetector(
onTap: () {
onTapTxtForgotPasswor();
},
child: Text("msg_forgot_password".tr,
style: CustomTextStyles
.labelLargeSecondaryContainerSemiBold))),
SizedBox(height: 23.v),
CustomElevatedButton(
text: "lbl_next".tr,
onPressed: () {
onTapNext();
}),
SizedBox(height: 33.v),
GestureDetector(
onTap: () {
onTapDonTHaveAnAccount();
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(bottom: 1.v),
child: Text(
"msg_don_t_have_an_account".tr,
style:
theme.textTheme.labelLarge)),
Padding(
padding: EdgeInsets.only(left: 8.h),
child: Text("lbl_signup2".tr,
style: CustomTextStyles
.labelLargeSecondaryContainerSemiBold))
]))
])))))),
);
}
/// Section Widget
PreferredSizeWidget _buildAppBar() {
return CustomAppBar(
leadingWidth: 56.h,
leading: AppbarLeadingIconbutton(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 32.h, top: 14.v, bottom: 17.v),
onTap: () {
onTapArrowLeft();
}),
actions: [
AppbarTitle(
text: "lbl_login".tr,
margin: EdgeInsets.symmetric(horizontal: 48.h, vertical: 14.v))
]);
}
/// Section Widget
Widget _buildPageHeader() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: 221.h,
margin: EdgeInsets.only(right: 89.h),
child: Text("Seamlessly Organize Tasks with Our Todo App !!....".tr,
maxLines: 4,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.displaySmall!.copyWith(height: 1.18))),
SizedBox(height: 1.v),
Container(
width: 282.h,
margin: EdgeInsets.only(right: 28.h),
child: Text("msg_our_community_is3".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.labelLarge!.copyWith(height: 1.67)))
]);
}
/// Navigates to the previous screen.
onTapArrowLeft() {
Get.back();
}
/// Navigates to the forgotPasswordScreen when the action is triggered.
onTapTxtForgotPasswor() {
Get.toNamed(
AppRoutes.forgotPasswordScreen,
);
}
/// Navigates to the signupScreen when the action is triggered.
onTapNext() {
Get.toNamed(
AppRoutes.homeScreen,
);
}
/// Navigates to the signupScreen when the action is triggered.
onTapDonTHaveAnAccount() {
Get.toNamed(
AppRoutes.signupScreen,
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen/models/login_model.dart | /// This class defines the variables used in the [login_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class LoginModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen/binding/login_binding.dart | import '../controller/login_controller.dart';
import 'package:get/get.dart';
/// A binding class for the LoginScreen.
///
/// This class ensures that the LoginController is created when the
/// LoginScreen is first loaded.
class LoginBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => LoginController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/login_screen/controller/login_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/login_screen/models/login_model.dart';
import 'package:flutter/material.dart';
/// A controller class for the LoginScreen.
///
/// This class manages the state of the LoginScreen, including the
/// current loginModelObj
class LoginController extends GetxController {
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
Rx<LoginModel> loginModelObj = LoginModel().obs;
@override
void onClose() {
super.onClose();
emailController.dispose();
passwordController.dispose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen/prioritise_screen.dart | import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/app_bar/appbar_image.dart';
import 'package:todo_app/widgets/app_bar/appbar_title.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import '../../theme/app_style.dart';
import '../../widgets/custom_button.dart';
import 'controller/prioritise_controller.dart';
class PrioritiseScreen extends GetWidget<PrioritiseController> {
DateTime today = DateTime.now().toUtc();
String getCurrentDayOfWeek() {
DateTime now = DateTime.now();
String formattedDate = DateFormat('EEEE').format(now);
return formattedDate;
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: ColorConstant.gray50,
appBar: CustomAppBar(
height: getVerticalSize(49),
leadingWidth: 40,
leading: AppbarImage(
height: getSize(24),
width: getSize(24),
svgPath: ImageConstant.imgArrowLeft,
margin: getMargin(left: 16, top: 12, bottom: 13),
onTap: () {
onTapArrowleft2();
},
),
centerTitle: true,
title: AppbarTitle(text: "Prioritise your Task"),
actions: [
AppbarImage(
height: getSize(24),
width: getSize(24),
svgPath: ImageConstant.imgOverflowmenu1,
margin: getMargin(left: 16, top: 12, right: 16, bottom: 13),
),
],
),
body: SingleChildScrollView(
child: Container(
width: double.maxFinite,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: getPadding(left: 16, top: 28),
child: Text(
"This Week",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold20,
),
),
Padding(
padding: getPadding(left: 16, top: 31),
child: Text(
"${getCurrentDayOfWeek()} ${today.day}th",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold16BlueA700,
),
),
buildTaskTile(
"Buy Groceries",
"low priority",
),
buildTaskTile(
"Cardio",
"low priority",
),
buildTaskTile(
"Dinner with family",
"high priority",
),
buildTaskTile(
"Pay college fees",
"low priority",
),
],
),
),
),
),
);
}
Widget buildTaskTile(String title, String priority) {
return Dismissible(
key: Key(title), // Unique key for each item
direction: DismissDirection.endToStart,
onDismissed: (direction) {
// Handle dismiss (in this case, you can delete the task)
if (direction == DismissDirection.endToStart) {
controller.deleteTask(title);
}
},
background: Container(
color: Colors.red, // Background color when sliding to delete
alignment: Alignment.centerRight,
padding: EdgeInsets.symmetric(horizontal: 16),
child: Icon(Icons.delete, color: Colors.white),
),
child: Container(
margin: getMargin(left: 16, top: 16, right: 16),
padding: getPadding(left: 16, top: 17, right: 16, bottom: 17),
decoration: AppDecoration.outlineGray70011.copyWith(
borderRadius: BorderRadiusStyle.roundedBorder6,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold16Gray90001,
),
SizedBox(height: getVerticalSize(6)),
Text(
priority,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
// style: AppStyle.txtGilroyRegular14Gray900,
),
],
),
CustomButton(
height: getVerticalSize(23),
width: getHorizontalSize(81),
text: "low priority",
margin: getMargin(bottom: 1),
variant: ButtonVariant.FillDeeporangeA10019,
fontStyle: ButtonFontStyle.GilroyMedium12Deeporange400,
),
],
),
),
);
}
onTapArrowleft2() {
Get.back();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen/models/prioritise_model.dart | class PrioritiseModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen/binding/prioritise_binding.dart | import '../controller/prioritise_controller.dart';
import 'package:get/get.dart';
class PrioritiseBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => PrioritiseController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/prioritise_screen/controller/prioritise_controller.dart | import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart';
import '../models/prioritise_model.dart';
class PrioritiseController extends GetxController {
Rx<PrioritiseModel> prioritiseModelObj = PrioritiseModel().obs;
// Method to perform an action on the task
void performAction(String taskTitle) {
// Add your logic here for performing the action
print("Action performed on task: $taskTitle");
}
// Method to delete a task
void deleteTask(String taskTitle) {
// Add your logic here for deleting the task
print("Task deleted: $taskTitle");
}
@override
void onReady() {
super.onReady();
}
@override
void onClose() {
super.onClose();
}
}
// Align(
// alignment: Alignment.center,
// child: Container(
// margin: getMargin(left: 16, top: 16, right: 16),
// padding: getPadding(
// left: 16, top: 17, right: 16, bottom: 17),
// decoration: AppDecoration.outlineGray70011.copyWith(
// borderRadius: BorderRadiusStyle.roundedBorder6),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Padding(
// padding: getPadding(top: 2, bottom: 1),
// child: Text("Cardio".tr,
// overflow: TextOverflow.ellipsis,
// textAlign: TextAlign.left,
// style: AppStyle
// .txtGilroySemiBold16Gray90001)),
// CustomButton(
// height: getVerticalSize(23),
// width: getHorizontalSize(81),
// text: "low priority",
// margin: getMargin(bottom: 1),
// variant: ButtonVariant.FillDeeporangeA10019,
// fontStyle: ButtonFontStyle
// .GilroyMedium12Deeporange400)
// ]))),
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen/language_screen.dart | import 'controller/language_controller.dart';
import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/custom_elevated_button.dart';
import 'package:todo_app/widgets/custom_icon_button.dart';
class LanguageScreen extends GetWidget<LanguageController> {
const LanguageScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 31.h, vertical: 43.v),
child: Column(children: [
CustomIconButton(
height: 24.adaptSize,
width: 24.adaptSize,
padding: EdgeInsets.all(6.h),
alignment: Alignment.centerLeft,
onTap: () {
onTapBtnArrowLeft();
},
child: CustomImageView(
imagePath: ImageConstant.imgArrowLeft)),
SizedBox(height: 82.v),
_buildPageHeader(),
SizedBox(height: 87.v),
CustomElevatedButton(
text: "lbl_indonesian2".tr,
buttonStyle: CustomButtonStyles.fillDeepOrange,
buttonTextStyle:
CustomTextStyles.labelLargeSecondaryContainer,
onPressed: () {
onTapIndonesian();
}),
SizedBox(height: 14.v),
CustomElevatedButton(
text: "lbl_english".tr,
buttonStyle: CustomButtonStyles.fillGray,
buttonTextStyle:
CustomTextStyles.labelLargeDeeppurpleA400),
Spacer(),
SizedBox(height: 53.v),
CustomElevatedButton(
text: "lbl_save".tr,
buttonTextStyle: CustomTextStyles.titleMediumWhiteA700,
onPressed: () {
onTapSave();
})
]))));
}
/// Section Widget
Widget _buildPageHeader() {
return Container(
padding: EdgeInsets.symmetric(horizontal: 1.h),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_language".tr, style: theme.textTheme.headlineMedium),
SizedBox(height: 7.v),
Text("msg_your_settings_so".tr, style: theme.textTheme.labelLarge)
]));
}
/// Navigates to the previous screen.
onTapBtnArrowLeft() {
Get.back();
}
/// Navigates to the loginScreen when the action is triggered.
onTapIndonesian() {
Get.toNamed(
AppRoutes.loginScreen,
);
}
/// Navigates to the signupScreen when the action is triggered.
onTapSave() {
Get.toNamed(
AppRoutes.signupScreen,
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen/models/language_model.dart | /// This class defines the variables used in the [language_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class LanguageModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen/binding/language_binding.dart | import '../controller/language_controller.dart';
import 'package:get/get.dart';
/// A binding class for the LanguageScreen.
///
/// This class ensures that the LanguageController is created when the
/// LanguageScreen is first loaded.
class LanguageBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => LanguageController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/language_screen/controller/language_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/language_screen/models/language_model.dart';
/// A controller class for the LanguageScreen.
///
/// This class manages the state of the LanguageScreen, including the
/// current languageModelObj
class LanguageController extends GetxController {
Rx<LanguageModel> languageModelObj = LanguageModel().obs;
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen/work_today_screen.dart | import 'package:flutter/material.dart';
import 'package:flutter_slider_drawer/flutter_slider_drawer.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/calendar_screen/calendar_screen.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import 'package:todo_app/widgets/custom_elevated_button.dart';
import 'package:todo_app/widgets/custom_icon_button.dart';
import 'controller/work_today_controller.dart';
class WorkTodayScreen extends GetWidget<WorkTodayController> {
WorkTodayScreen({Key? key}) : super(key: key);
GlobalKey<SliderDrawerState> dKey = GlobalKey<SliderDrawerState>();
DateTime today = DateTime.now().toUtc();
String formattedDate = "";
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: SliderDrawer(
isDraggable: false,
key: dKey,
animationDuration: 1000,
/// My AppBar
appBar: MyAppBar(
drawerKey: dKey,
),
/// My Drawer Slider
slider: MySlider(),
child: SingleChildScrollView(
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 32.h, vertical: 3.v),
child: Column(children: [
// CustomIconButton(
// height: 24.adaptSize,
// width: 24.adaptSize,
// alignment: Alignment.centerLeft,
// onTap: () {
// onTapBtnArrowLeft();
// },
// child: CustomImageView(
// imagePath: ImageConstant.imgArrowLeftBlack900)),
SizedBox(height: 1.v),
_buildPageHeader(),
SizedBox(height: 58.v),
_buildDate(),
SizedBox(height: 59.v),
_buildTodoFeatureItem("My Task", AppRoutes.myTaskScreen),
_buildTodoFeatureItem(
"Task Management", AppRoutes.taskViewsScreen),
_buildTodoFeatureItem(
"Working hours on Task ", AppRoutes.progressTimePicker),
_buildTodoFeatureItem(
"Prioritise your Task", AppRoutes.prioritiseScreen),
SizedBox(height: 56.v),
CustomElevatedButton(
text: "Create a new Task".tr,
buttonTextStyle: CustomTextStyles.titleMediumWhiteA700,
onPressed: () {
Get.toNamed(AppRoutes.taskFormScreen);
}),
SizedBox(height: 5.v)
])),
),
)));
}
/// Section Widget
Widget _buildPageHeader() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("Schedule your task with following features!".tr,
style: theme.textTheme.headlineMedium),
SizedBox(height: 7.v),
Text("msg_make_your_job_easier".tr, style: theme.textTheme.labelLarge)
]);
}
/// Section Widget
Widget _buildDate() {
return Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Padding(
padding: EdgeInsets.only(top: 6.v, bottom: 2.v),
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text("lbl_today".tr, style: CustomTextStyles.titleSmallBlack900),
SizedBox(height: 5.v),
Text("${today.day}-${today.month}-${today.year}".tr,
style: CustomTextStyles.titleMediumBlack900)
])),
CustomIconButton(
onTap: () {
// Get.toNamed(
// AppRoutes.calendarScreen,
// );
Get.to(() => CalendarScreen());
},
height: 58.v,
width: 60.h,
padding: EdgeInsets.all(17.h),
decoration: IconButtonStyleHelper.fillGray,
child: CustomImageView(imagePath: ImageConstant.imgCalendar))
]);
}
/// Section Widget
Widget _buildTodoFeatureItem(String featureName, AppRoutes) {
return GestureDetector(
onTap: () {
Get.toNamed(AppRoutes);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 27.h, vertical: 15.v),
decoration: AppDecoration.fillWhiteA,
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
Container(
height: 26.v,
width: 28.h,
decoration: BoxDecoration(
color:
theme.colorScheme.secondaryContainer.withOpacity(0.2),
borderRadius: BorderRadius.circular(6.h))),
Padding(
padding: EdgeInsets.only(left: 13.h, top: 3.v, bottom: 2.v),
child:
Text("${featureName}", style: theme.textTheme.bodyMedium)),
Spacer(),
CustomImageView(
imagePath: ImageConstant.imgArrowIcon,
height: 5.v,
width: 3.h,
margin: EdgeInsets.symmetric(vertical: 10.v))
])),
);
}
/// Navigates to the previous screen.
onTapBtnArrowLeft() {
Get.back();
}
/// Navigates to the signupScreen when the action is triggered.
onTapMakeAWishList() {
Get.toNamed(
AppRoutes.signupScreen,
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen/models/work_today_model.dart | /// This class defines the variables used in the [work_today_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class WorkTodayModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen/binding/work_today_binding.dart | import '../controller/work_today_controller.dart';
import 'package:get/get.dart';
/// A binding class for the WorkTodayScreen.
///
/// This class ensures that the WorkTodayController is created when the
/// WorkTodayScreen is first loaded.
class WorkTodayBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => WorkTodayController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/work_today_screen/controller/work_today_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/work_today_screen/models/work_today_model.dart';
/// A controller class for the WorkTodayScreen.
///
/// This class manages the state of the WorkTodayScreen, including the
/// current workTodayModelObj
class WorkTodayController extends GetxController {
Rx<WorkTodayModel> workTodayModelObj = WorkTodayModel().obs;
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/tasks/task_view.dart | // ignore_for_file: prefer_typing_uninitialized_variables
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import '../../data/models/task.dart';
///
import '../../main.dart';
import '../../theme/colors.dart';
import '../../theme/constanst.dart';
import '../../theme/strings.dart';
// ignore: must_be_immutable
class TaskView extends StatefulWidget {
TaskView({
Key? key,
required this.taskControllerForTitle,
required this.taskControllerForSubtitle,
required this.task,
}) : super(key: key);
TextEditingController? taskControllerForTitle;
TextEditingController? taskControllerForSubtitle;
final Task? task;
@override
State<TaskView> createState() => _TaskViewState();
}
class _TaskViewState extends State<TaskView> {
var title;
var subtitle;
DateTime? time;
DateTime? date;
/// Show Selected Time As String Format
String showTime(DateTime? time) {
if (widget.task?.createdAtTime == null) {
if (time == null) {
return DateFormat('hh:mm a').format(DateTime.now()).toString();
} else {
return DateFormat('hh:mm a').format(time).toString();
}
} else {
return DateFormat('hh:mm a')
.format(widget.task!.createdAtTime)
.toString();
}
}
/// Show Selected Time As DateTime Format
DateTime showTimeAsDateTime(DateTime? time) {
if (widget.task?.createdAtTime == null) {
if (time == null) {
return DateTime.now();
} else {
return time;
}
} else {
return widget.task!.createdAtTime;
}
}
/// Show Selected Date As String Format
String showDate(DateTime? date) {
if (widget.task?.createdAtDate == null) {
if (date == null) {
return DateFormat.yMMMEd().format(DateTime.now()).toString();
} else {
return DateFormat.yMMMEd().format(date).toString();
}
} else {
return DateFormat.yMMMEd().format(widget.task!.createdAtDate).toString();
}
}
// Show Selected Date As DateTime Format
DateTime showDateAsDateTime(DateTime? date) {
if (widget.task?.createdAtDate == null) {
if (date == null) {
return DateTime.now();
} else {
return date;
}
} else {
return widget.task!.createdAtDate;
}
}
/// If any Task Already exist return TRUE otherWise FALSE
bool isTaskAlreadyExistBool() {
if (widget.taskControllerForTitle?.text == null &&
widget.taskControllerForSubtitle?.text == null) {
return true;
} else {
return false;
}
}
/// If any task already exist app will update it otherwise the app will add a new task
dynamic isTaskAlreadyExistUpdateTask() {
if (widget.taskControllerForTitle?.text != null &&
widget.taskControllerForSubtitle?.text != null) {
try {
widget.taskControllerForTitle?.text = title;
widget.taskControllerForSubtitle?.text = subtitle;
// widget.task?.createdAtDate = date!;
// widget.task?.createdAtTime = time!;
widget.task?.save();
Navigator.of(context).pop();
} catch (error) {
nothingEnterOnUpdateTaskMode(context);
}
} else {
if (title != null && subtitle != null) {
var task = Task.create(
title: title,
createdAtTime: time,
createdAtDate: date,
subtitle: subtitle,
);
BaseWidget.of(context).dataStore.addTask(task: task);
Navigator.of(context).pop();
} else {
emptyFieldsWarning(context);
}
}
}
/// Delete Selected Task
dynamic deleteTask() {
return widget.task?.delete();
}
@override
Widget build(BuildContext context) {
var textTheme = Theme.of(context).textTheme;
return GestureDetector(
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
child: Scaffold(
backgroundColor: Colors.white,
appBar: const MyAppBar(),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: Center(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
/// new / update Task Text
_buildTopText(textTheme),
/// Middle Two TextFileds, Time And Date Selection Box
_buildMiddleTextFieldsANDTimeAndDateSelection(
context, textTheme),
/// All Bottom Buttons
_buildBottomButtons(context),
],
),
),
),
),
),
);
}
/// All Bottom Buttons
Padding _buildBottomButtons(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(bottom: 20),
child: Row(
mainAxisAlignment: isTaskAlreadyExistBool()
? MainAxisAlignment.center
: MainAxisAlignment.spaceEvenly,
children: [
isTaskAlreadyExistBool()
? Container()
/// Delete Task Button
: Container(
width: 150,
height: 55,
decoration: BoxDecoration(
border:
Border.all(color: MyColors.primaryColor, width: 2),
borderRadius: BorderRadius.circular(15)),
child: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
minWidth: 150,
height: 55,
onPressed: () {
deleteTask();
Navigator.pop(context);
},
color: Colors.white,
child: Row(
children: const [
Icon(
Icons.close,
color: MyColors.primaryColor,
),
SizedBox(
width: 5,
),
Text(
MyString.deleteTask,
style: TextStyle(
color: MyColors.primaryColor,
),
),
],
),
),
),
/// Add or Update Task Button
MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
minWidth: 150,
height: 55,
onPressed: () {
isTaskAlreadyExistUpdateTask();
},
color: MyColors.primaryColor,
child: Text(
isTaskAlreadyExistBool()
? MyString.addTaskString
: MyString.updateTaskString,
style: const TextStyle(
color: Colors.white,
),
),
),
],
),
);
}
/// Middle Two TextFileds And Time And Date Selection Box
SizedBox _buildMiddleTextFieldsANDTimeAndDateSelection(
BuildContext context, TextTheme textTheme) {
return SizedBox(
width: double.infinity,
height: 535,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
/// Title of TextFiled
Padding(
padding: const EdgeInsets.only(left: 30),
child: Text(MyString.titleOfTitleTextField,
style: textTheme.headline4),
),
/// Title TextField
Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.symmetric(horizontal: 16),
child: ListTile(
title: TextFormField(
controller: widget.taskControllerForTitle,
maxLines: 6,
cursorHeight: 60,
style: const TextStyle(color: Colors.black),
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey.shade300),
),
),
onFieldSubmitted: (value) {
title = value;
FocusManager.instance.primaryFocus?.unfocus();
},
onChanged: (value) {
title = value;
},
),
),
),
const SizedBox(
height: 10,
),
/// Note TextField
Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.symmetric(horizontal: 16),
child: ListTile(
title: TextFormField(
controller: widget.taskControllerForSubtitle,
style: const TextStyle(color: Colors.black),
decoration: InputDecoration(
prefixIcon:
const Icon(Icons.bookmark_border, color: Colors.grey),
border: InputBorder.none,
counter: Container(),
hintText: MyString.addNote,
),
onFieldSubmitted: (value) {
subtitle = value;
},
onChanged: (value) {
subtitle = value;
},
),
),
),
/// Time Picker
GestureDetector(
onTap: () {
// DatePicker.showTimePicker(context,
// showTitleActions: true,
// showSecondsColumn: false,
// onChanged: (_) {}, onConfirm: (selectedTime) {
// setState(() {
// if (widget.task?.createdAtTime == null) {
// time = selectedTime;
// } else {
// widget.task!.createdAtTime = selectedTime;
// }
// });
//
// FocusManager.instance.primaryFocus?.unfocus();
// }, currentTime: showTimeAsDateTime(time));
},
child: Container(
margin: const EdgeInsets.fromLTRB(20, 20, 20, 10),
width: double.infinity,
height: 55,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey.shade300, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 10),
child:
Text(MyString.timeString, style: textTheme.headline5),
),
Expanded(child: Container()),
Container(
margin: const EdgeInsets.only(right: 10),
width: 80,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey.shade100),
child: Center(
child: Text(
showTime(time),
style: textTheme.subtitle2,
),
),
)
],
),
),
),
/// Date Picker
GestureDetector(
onTap: () {
// DatePicker.showDatePicker(context,
// showTitleActions: true,
// minTime: DateTime.now(),
// maxTime: DateTime(2030, 3, 5),
// onChanged: (_) {}, onConfirm: (selectedDate) {
// setState(() {
// if (widget.task?.createdAtDate == null) {
// date = selectedDate;
// } else {
// widget.task!.createdAtDate = selectedDate;
// }
// });
// FocusManager.instance.primaryFocus?.unfocus();
// }, currentTime: showDateAsDateTime(date));
},
child: Container(
margin: const EdgeInsets.fromLTRB(20, 10, 20, 10),
width: double.infinity,
height: 55,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey.shade300, width: 1),
borderRadius: BorderRadius.circular(10),
),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(left: 10),
child:
Text(MyString.dateString, style: textTheme.headline5),
),
Expanded(child: Container()),
Container(
margin: const EdgeInsets.only(right: 10),
width: 140,
height: 35,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.grey.shade100),
child: Center(
child: Text(
showDate(date),
style: textTheme.subtitle2,
),
),
)
],
),
),
)
],
),
);
}
/// new / update Task Text
SizedBox _buildTopText(TextTheme textTheme) {
return SizedBox(
width: double.infinity,
height: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(
width: 70,
child: Divider(
thickness: 2,
),
),
RichText(
text: TextSpan(
text: isTaskAlreadyExistBool()
? MyString.addNewTask
: MyString.updateCurrentTask,
style: textTheme.headline6,
children: const [
TextSpan(
text: MyString.taskStrnig,
style: TextStyle(
fontWeight: FontWeight.w400,
),
)
]),
),
const SizedBox(
width: 70,
child: Divider(
thickness: 2,
),
),
],
),
);
}
}
/// AppBar
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
const MyAppBar({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
height: 150,
child: Padding(
padding: const EdgeInsets.only(top: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(left: 20),
child: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(
Icons.arrow_back_ios_new_rounded,
size: 50,
),
),
),
],
),
),
);
}
@override
Size get preferredSize => const Size.fromHeight(100);
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen/app_navigation_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'controller/app_navigation_controller.dart';
// ignore_for_file: must_be_immutable
class AppNavigationScreen extends GetWidget<AppNavigationController> {
const AppNavigationScreen({Key? key})
: super(
key: key,
);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Color(0XFFFFFFFF),
body: SizedBox(
width: double.maxFinite,
child: Column(
children: [
_buildAppNavigation(),
Expanded(
child: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
_buildScreenTitle(
screenTitle: "Adacana".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.splashScreen),
),
_buildScreenTitle(
screenTitle: "Login or SignUp".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.loginOrSignupScreen),
),
_buildScreenTitle(
screenTitle: "SignUp".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.signupScreen),
),
_buildScreenTitle(
screenTitle: "Login".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.loginScreen),
),
_buildScreenTitle(
screenTitle: "Forgot Password".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.forgotPasswordScreen),
),
_buildScreenTitle(
screenTitle: "Home".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.homeScreen),
),
_buildScreenTitle(
screenTitle: "Personality".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.personalityScreen),
),
_buildScreenTitle(
screenTitle: "Work Today".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.workTodayScreen),
),
_buildScreenTitle(
screenTitle: "Wish List".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.wishListScreen),
),
_buildScreenTitle(
screenTitle: "Settings".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.settingsScreen),
),
_buildScreenTitle(
screenTitle: "Language".tr,
onTapScreenTitle: () =>
onTapScreenTitle(AppRoutes.languageScreen),
),
_buildScreenTitle(
screenTitle: "TermsAndConditions".tr,
onTapScreenTitle: () => onTapScreenTitle(
AppRoutes.termsandconditionsScreen),
),
],
),
),
),
),
],
),
),
),
);
}
/// Section Widget
Widget _buildAppNavigation() {
return Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
"App Navigation".tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: 20.h),
child: Text(
"Check your app's UI from the below demo screens of your app."
.tr,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF888888),
fontSize: 16.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF000000),
),
],
),
);
}
/// Common widget
Widget _buildScreenTitle({
required String screenTitle,
Function? onTapScreenTitle,
}) {
return GestureDetector(
onTap: () {
onTapScreenTitle!.call();
},
child: Container(
decoration: BoxDecoration(
color: Color(0XFFFFFFFF),
),
child: Column(
children: [
SizedBox(height: 10.v),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.h),
child: Text(
screenTitle,
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0XFF000000),
fontSize: 20.fSize,
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
),
),
),
),
SizedBox(height: 10.v),
SizedBox(height: 5.v),
Divider(
height: 1.v,
thickness: 1.v,
color: Color(0XFF888888),
),
],
),
),
);
}
/// Common click event
void onTapScreenTitle(String routeName) {
Get.toNamed(routeName);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen/models/app_navigation_model.dart | /// This class defines the variables used in the [app_navigation_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class AppNavigationModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen/binding/app_navigation_binding.dart | import '../controller/app_navigation_controller.dart';
import 'package:get/get.dart';
/// A binding class for the AppNavigationScreen.
///
/// This class ensures that the AppNavigationController is created when the
/// AppNavigationScreen is first loaded.
class AppNavigationBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => AppNavigationController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/app_navigation_screen/controller/app_navigation_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/app_navigation_screen/models/app_navigation_model.dart';
/// A controller class for the AppNavigationScreen.
///
/// This class manages the state of the AppNavigationScreen, including the
/// current appNavigationModelObj
class AppNavigationController extends GetxController {
Rx<AppNavigationModel> appNavigationModelObj = AppNavigationModel().obs;
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen/splash_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'controller/adacana_controller.dart';
class SplashScreen extends GetWidget<SplashController> {
const SplashScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SafeArea(
child: GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.loginOrSignupScreen);
},
child: Scaffold(
body: SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 1.v),
Image.asset("assets/images/mad.gif")
// CustomImageView(
// imagePath: ImageConstant.imgLogo,
// height: 325.v,
// width: 238.h,
// onTap: () {
// onTapImgLogo();
// })
]))),
));
}
/// Navigates to the loginOrSignupScreen when the action is triggered.
onTapImgLogo() {
Get.toNamed(
AppRoutes.loginOrSignupScreen,
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen/models/adacana_model.dart | /// This class defines the variables used in the [Splash_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class SplashModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen/binding/adacana_binding.dart | import 'package:get/get.dart';
import '../controller/adacana_controller.dart';
/// A binding class for the SplashScreen.
///
/// This class ensures that the SplashController is created when the
/// SplashScreen is first loaded.
class SplashBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => SplashController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/splash_screen/controller/adacana_controller.dart | import 'package:todo_app/core/app_export.dart';
import '../models/adacana_model.dart';
/// A controller class for the SplashScreen.
///
/// This class manages the state of the SplashScreen, including the
/// current SplashModelObj
class SplashController extends GetxController {
Rx<SplashModel> SplashModelObj = SplashModel().obs;
@override
void onReady() {
Future.delayed(const Duration(milliseconds: 2000), () {
Get.offNamed(
AppRoutes.loginOrSignupScreen,
);
});
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen/task_list_screen.dart | import 'package:animate_do/animate_do.dart';
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:intl/intl.dart';
import 'package:lottie/lottie.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/app_bar/appbar_image.dart';
import 'package:todo_app/widgets/app_bar/appbar_title.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import 'package:todo_app/widgets/custom_button.dart';
import 'package:todo_app/widgets/custom_floating_button.dart';
import '../../data/models/task.dart';
import '../../main.dart';
import '../../theme/app_style.dart';
import '../../theme/colors.dart';
import '../../theme/constanst.dart';
import '../../theme/strings.dart';
import '../../widgets/task_widget.dart';
import 'controller/task_list_controller.dart';
class MyTaskScreen extends GetWidget<MyTaskController> {
TextEditingController taskTitleController = new TextEditingController();
TextEditingController taskDescriptionController = new TextEditingController();
TextEditingController taskController = new TextEditingController();
DateTime today = DateTime.now().toUtc();
String getCurrentDayOfWeek() {
DateTime now = DateTime.now();
String formattedDate = DateFormat('EEEE').format(now);
return formattedDate;
}
/// Checking Done Tasks
int checkDoneTask(List<Task> task) {
int i = 0;
for (Task doneTasks in task) {
if (doneTasks.isCompleted) {
i++;
}
}
return i;
}
/// Checking The Value Of the Circle Indicator
dynamic valueOfTheIndicator(List<Task> task) {
if (task.isNotEmpty) {
return task.length;
} else {
return 3;
}
}
@override
Widget build(BuildContext context) {
final base = BaseWidget.of(context);
var textTheme = Theme.of(context).textTheme;
return SafeArea(
child: DefaultTabController(
length: 2,
child: Scaffold(
backgroundColor: ColorConstant.gray50,
appBar: CustomAppBarWithBottomBar(
height: getVerticalSize(200),
leadingWidth: 40,
leading: AppbarImage(
height: getSize(24),
width: getSize(24),
svgPath: ImageConstant.imgArrowleft,
margin: getMargin(left: 16, top: 12, bottom: 17),
onTap: () {
onTapArrowleft1();
}),
centerTitle: true,
title: AppbarTitle(text: "My Tasks"),
bottom: TabBar(unselectedLabelColor: Colors.white60, tabs: [
Tab(
icon: Icon(Icons.pending_actions),
text: 'Pending Actions',
),
Tab(
icon: Icon(Icons.calendar_view_week),
text: 'Weekly Actions',
),
]),
actions: [
AppbarImage(
height: getSize(24),
width: getSize(24),
svgPath: ImageConstant.imgOverflowmenu1,
margin: getMargin(left: 16, top: 12, right: 16, bottom: 17))
]),
body: TabBarView(
children: [
Center(
child: ValueListenableBuilder(
valueListenable: base.dataStore.listenToTask(),
builder: (ctx, Box<Task> box, Widget? child) {
var tasks = box.values.toList();
/// Sort Task List
tasks.sort(((a, b) =>
a.createdAtDate.compareTo(b.createdAtDate)));
return _buildBody(tasks, base, textTheme);
})),
Center(
child: SingleChildScrollView(
child: Container(
width: double.maxFinite,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: getPadding(left: 16, top: 24),
child: Text("This Week".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold20))),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: getPadding(left: 16, top: 31),
child: Text(
"${getCurrentDayOfWeek()} ${today.day}th",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16BlueA700))),
Container(
margin: getMargin(left: 16, top: 18, right: 16),
padding: getPadding(
left: 16, top: 17, right: 16, bottom: 17),
decoration: AppDecoration.outlineGray70011
.copyWith(
borderRadius:
BorderRadiusStyle.roundedBorder6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
getPadding(top: 3, bottom: 1),
child: Text("Buy groceries",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16Gray90001)),
CustomButton(
height: getVerticalSize(23),
width: getHorizontalSize(85),
text: "High Priority".tr,
margin: getMargin(bottom: 1),
variant: ButtonVariant.FillGray100,
fontStyle:
ButtonFontStyle.GilroyMedium12)
])),
Container(
margin: getMargin(left: 16, top: 16, right: 16),
padding: getPadding(
left: 16, top: 17, right: 16, bottom: 17),
decoration: AppDecoration.outlineGray70011
.copyWith(
borderRadius:
BorderRadiusStyle.roundedBorder6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
getPadding(top: 2, bottom: 1),
child: Text("Cardio at 6pm ".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16Gray90001)),
CustomButton(
height: getVerticalSize(23),
width: getHorizontalSize(81),
text: "Low Priority".tr,
margin: getMargin(bottom: 1),
variant: ButtonVariant
.FillDeeporangeA10033,
fontStyle: ButtonFontStyle
.GilroyMedium12Deeporange400)
])),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: getPadding(left: 16, top: 24),
child: Text("Next Week".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroySemiBold20))),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: getPadding(left: 16, top: 28),
child: Text("Wednesday 14th".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16BlueA700))),
Container(
margin: getMargin(left: 16, top: 17, right: 16),
padding: getPadding(
left: 16, top: 17, right: 16, bottom: 17),
decoration: AppDecoration.outlineGray70011
.copyWith(
borderRadius:
BorderRadiusStyle.roundedBorder6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
getPadding(top: 1, bottom: 2),
child: Text("Dinner with fam ".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16Gray90001)),
CustomButton(
height: getVerticalSize(23),
width: getHorizontalSize(85),
text: "High Priority".tr,
margin: getMargin(bottom: 1),
variant: ButtonVariant.FillGray100,
fontStyle:
ButtonFontStyle.GilroyMedium12)
])),
Container(
margin: getMargin(
left: 16, top: 16, right: 16, bottom: 377),
padding: getPadding(
left: 16, top: 17, right: 16, bottom: 17),
decoration: AppDecoration.outlineGray70011
.copyWith(
borderRadius:
BorderRadiusStyle.roundedBorder6),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
getPadding(top: 2, bottom: 1),
child: Text("Pay my clg fees".tr,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle
.txtGilroySemiBold16Gray90001)),
CustomButton(
height: getVerticalSize(23),
width: getHorizontalSize(81),
text: "Low Priority".tr,
margin: getMargin(bottom: 1),
variant: ButtonVariant
.FillDeeporangeA10033,
fontStyle: ButtonFontStyle
.GilroyMedium12Deeporange400)
]))
])),
),
),
],
),
floatingActionButton: CustomFloatingButton(
height: 60,
width: 60,
child: const Icon(Icons.add),
onTap: () {
Get.toNamed(AppRoutes.taskFormScreen);
// showDialog(
// context: context,
// builder: (context) {
// return AlertDialog(
// scrollable: true,
// title: const Text(
// 'Create your new task: ',
// style: TextStyle(fontSize: 15),
// ),
// content: Padding(
// padding: const EdgeInsets.all(6),
// child: TextField(
// controller: taskController,
// ),
// ),
// actions: [
// ElevatedButton(
// onPressed: () {}, child: const Text('Add'))
// ],
// );
// });
},
)),
));
}
onTapArrowleft1() {
Get.back();
}
SizedBox _buildBody(
List<Task> tasks,
BaseWidget base,
TextTheme textTheme,
) {
return SizedBox(
width: double.infinity,
height: double.infinity,
child: Column(
children: [
/// Top Section Of Home page : Text, Progrss Indicator
Container(
margin: const EdgeInsets.fromLTRB(55, 0, 0, 0),
width: double.infinity,
height: 100,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
/// CircularProgressIndicator
SizedBox(
width: 25,
height: 25,
child: CircularProgressIndicator(
valueColor:
const AlwaysStoppedAnimation(MyColors.primaryColor),
backgroundColor: Colors.grey,
value: checkDoneTask(tasks) / valueOfTheIndicator(tasks),
),
),
const SizedBox(
width: 25,
),
/// Texts
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Text(MyString.mainTitle, style: textTheme.headline1),
const SizedBox(
height: 3,
),
Text("${checkDoneTask(tasks)} of ${tasks.length} task",
style: textTheme.subtitle1),
],
)
],
),
),
/// Divider
/// Bottom ListView : Tasks
Expanded(
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: tasks.isNotEmpty
? ListView.builder(
physics: const BouncingScrollPhysics(),
itemCount: tasks.length,
itemBuilder: (BuildContext context, int index) {
var task = tasks[index];
return Dismissible(
direction: DismissDirection.horizontal,
background: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(
Icons.delete_outline,
color: Colors.grey,
),
SizedBox(
width: 8,
),
Text(MyString.deletedTask,
style: TextStyle(
color: Colors.grey,
))
],
),
onDismissed: (direction) {
base.dataStore.dalateTask(task: task);
},
key: Key(task.id),
child: TaskWidget(
task: tasks[index],
),
);
},
)
/// if All Tasks Done Show this Widgets
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
/// Lottie
FadeIn(
child: SizedBox(
width: 200,
height: 200,
child: Lottie.asset(
lottieURL,
animate: tasks.isNotEmpty ? false : true,
),
),
),
/// Bottom Texts
FadeInUp(
from: 30,
child: const Text(MyString.doneAllTask),
),
],
),
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen/models/task_list_model.dart | class TaskListModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen/binding/task_list_binding.dart | import 'package:get/get.dart';
import '../controller/task_list_controller.dart';
class TaskListBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => MyTaskController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/task_list_screen/controller/task_list_controller.dart | import 'package:get/get.dart';
import 'package:todo_app/presentation/task_list_screen/models/task_list_model.dart';
import '../../../data/models/task.dart';
class MyTaskController extends GetxController {
Rx<TaskListModel> taskListModelObj = TaskListModel().obs;
//
// @override
// void onReady() {
// super.onReady();
// Future.delayed(const Duration(milliseconds: 3000), () {
// Get.offNamed(
// AppRoutes.taskViewsScreen,
// );
// });
// }
/// Checking Done Tasks
int checkDoneTask(List<Task> task) {
int i = 0;
for (Task doneTasks in task) {
if (doneTasks.isCompleted) {
i++;
}
}
return i;
}
/// Checking The Value Of the Circle Indicator
dynamic valueOfTheIndicator(List<Task> task) {
if (task.isNotEmpty) {
return task.length;
} else {
return 3;
}
}
@override
void onClose() {
super.onClose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen/termsandconditions_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/widgets/custom_icon_button.dart';
import 'controller/termsandconditions_controller.dart';
class TermsandconditionsScreen extends GetWidget<TermsandconditionsController> {
const TermsandconditionsScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: SingleChildScrollView(
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(horizontal: 32.h, vertical: 43.v),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CustomIconButton(
height: 24.adaptSize,
width: 24.adaptSize,
padding: EdgeInsets.all(6.h),
onTap: () {
onTapBtnArrowLeft();
},
child:
CustomImageView(imagePath: ImageConstant.imgArrowLeft)),
SizedBox(height: 79.v),
SizedBox(
width: 155.h,
child: Text("msg_terms_and_conditions".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.headlineMedium!
.copyWith(height: 1.36))),
SizedBox(height: 63.v),
Container(
width: 285.h,
margin: EdgeInsets.only(right: 25.h),
child: Text(
'''---
Welcome to Evyan To-do App !
These terms and conditions outline the rules and regulations for the use of Evyan To-do-App's Todo Application.
By accessing this application, we assume you accept these terms and conditions. Do not continue to use Evyan To-do App if you do not agree to all of the terms and conditions stated on this page.
1. User Content
By using our application, you agree to provide accurate, complete, and current information when creating tasks or interacting with the application. You are solely responsible for the content you submit, and any consequences that may arise from your actions.
2. Privacy Policy
Your use of Evyan To-do App is also governed by our Privacy Policy. Please review our Privacy Policy, which outlines how we collect, use, and protect your personal information.
3. Account Security
You are responsible for maintaining the confidentiality of your account and password. You agree to notify us immediately of any unauthorized access or use of your account.
4. Prohibited Activities
You must not use Evyan To-do App for any unlawful or prohibited activities. This includes, but is not limited to, violating any applicable local or international laws, infringing upon the rights of others, or engaging in any harmful or malicious activities.
5. Termination
We reserve the right to terminate or suspend your account and access to Evyan To-do App at our sole discretion, without prior notice or liability, for any reason, including, but not limited to, breach of these terms.
6. Modifications to Terms
We may revise these terms and conditions at any time without prior notice. By using Evyan To-do App , you agree to be bound by the current version of these terms and conditions.
7. Contact Information
If you have any questions or concerns about our terms and conditions.
---
'''
.tr,
maxLines: 100,
overflow: TextOverflow.ellipsis,
style: CustomTextStyles.bodySmallOnPrimary_1
.copyWith(height: 2.00))),
SizedBox(height: 2.v)
])),
)));
}
/// Navigates to the previous screen.
onTapBtnArrowLeft() {
Get.back();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen/models/termsandconditions_model.dart | /// This class defines the variables used in the [termsandconditions_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class TermsandconditionsModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen/binding/termsandconditions_binding.dart | import '../controller/termsandconditions_controller.dart';
import 'package:get/get.dart';
/// A binding class for the TermsandconditionsScreen.
///
/// This class ensures that the TermsandconditionsController is created when the
/// TermsandconditionsScreen is first loaded.
class TermsandconditionsBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => TermsandconditionsController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/termsandconditions_screen/controller/termsandconditions_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/termsandconditions_screen/models/termsandconditions_model.dart';
/// A controller class for the TermsandconditionsScreen.
///
/// This class manages the state of the TermsandconditionsScreen, including the
/// current termsandconditionsModelObj
class TermsandconditionsController extends GetxController {
Rx<TermsandconditionsModel> termsandconditionsModelObj =
TermsandconditionsModel().obs;
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation | mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen/forgot_password_screen.dart | import 'package:flutter/material.dart';
import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/core/utils/validation_functions.dart';
import 'package:todo_app/widgets/app_bar/appbar_leading_iconbutton.dart';
import 'package:todo_app/widgets/app_bar/appbar_title.dart';
import 'package:todo_app/widgets/app_bar/custom_app_bar.dart';
import 'package:todo_app/widgets/custom_elevated_button.dart';
import 'package:todo_app/widgets/custom_text_form_field.dart';
import 'controller/forgot_password_controller.dart';
// ignore_for_file: must_be_immutable
class ForgotPasswordScreen extends GetWidget<ForgotPasswordController> {
ForgotPasswordScreen({Key? key}) : super(key: key);
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
Get.focusScope!.unfocus();
},
child: SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: _buildAppBar(),
body: Center(
child: SingleChildScrollView(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
child: Form(
key: _formKey,
child: Container(
width: double.maxFinite,
padding: EdgeInsets.symmetric(
horizontal: 31.h, vertical: 22.v),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_buildPageHeader(),
SizedBox(height: 36.v),
CustomImageView(
imagePath: ImageConstant
.imgLogoGray5001121x135,
height: 121.v,
width: 135.h),
SizedBox(height: 27.v),
Text("lbl_forgot_password".tr,
style: theme.textTheme.titleMedium),
SizedBox(height: 45.v),
CustomTextFormField(
controller: controller.emailController,
hintText: "lbl_your_email".tr,
textInputAction: TextInputAction.done,
textInputType:
TextInputType.emailAddress,
validator: (value) {
if (value == null ||
(!isValidEmail(value,
isRequired: true))) {
return "err_msg_please_enter_valid_email"
.tr;
}
return null;
}),
SizedBox(height: 19.v),
Align(
alignment: Alignment.centerLeft,
child: Container(
width: 246.h,
margin:
EdgeInsets.only(right: 64.h),
child: Text("Try another way ?".tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: theme
.textTheme.bodySmall!
.copyWith(height: 1.67)))),
SizedBox(height: 4.v)
]))))),
bottomNavigationBar: _buildStart())),
);
}
/// Section Widget
PreferredSizeWidget _buildAppBar() {
return CustomAppBar(
leadingWidth: 56.h,
leading: AppbarLeadingIconbutton(
imagePath: ImageConstant.imgArrowLeft,
margin: EdgeInsets.only(left: 32.h, top: 14.v, bottom: 17.v),
onTap: () {
onTapArrowLeft();
}),
actions: [
AppbarTitle(
text: "lbl_forgot_password".tr,
margin: EdgeInsets.symmetric(horizontal: 35.h, vertical: 14.v))
]);
}
/// Section Widget
Widget _buildPageHeader() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: 262.h,
margin: EdgeInsets.only(right: 48.h),
child: Text("No worries! Reset your password effortlessly.".tr,
maxLines: 4,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.displaySmall!.copyWith(height: 1.29))),
Container(
width: 245.h,
margin: EdgeInsets.only(right: 65.h),
child: Text(
"Enter your email, and we'll guide you through the steps to regain control of your account. Your productivity journey awaits..."
.tr,
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.labelLarge!.copyWith(height: 1.67)))
]);
}
/// Section Widget
Widget _buildStart() {
return CustomElevatedButton(
text: "lbl_start".tr,
margin: EdgeInsets.only(left: 32.h, right: 32.h, bottom: 52.v),
onPressed: () {
onTapStart();
});
}
/// Navigates to the previous screen.
onTapArrowLeft() {
Get.back();
}
/// Navigates to the signupScreen when the action is triggered.
onTapStart() {
Get.toNamed(
AppRoutes.homeScreen,
);
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen/models/forgot_password_model.dart | /// This class defines the variables used in the [forgot_password_screen],
/// and is typically used to hold data that is passed between different parts of the application.
class ForgotPasswordModel {}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen/binding/forgot_password_binding.dart | import '../controller/forgot_password_controller.dart';
import 'package:get/get.dart';
/// A binding class for the ForgotPasswordScreen.
///
/// This class ensures that the ForgotPasswordController is created when the
/// ForgotPasswordScreen is first loaded.
class ForgotPasswordBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut(() => ForgotPasswordController());
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen | mirrored_repositories/Evyan-Todo-App/lib/presentation/forgot_password_screen/controller/forgot_password_controller.dart | import 'package:todo_app/core/app_export.dart';
import 'package:todo_app/presentation/forgot_password_screen/models/forgot_password_model.dart';
import 'package:flutter/material.dart';
/// A controller class for the ForgotPasswordScreen.
///
/// This class manages the state of the ForgotPasswordScreen, including the
/// current forgotPasswordModelObj
class ForgotPasswordController extends GetxController {
TextEditingController emailController = TextEditingController();
Rx<ForgotPasswordModel> forgotPasswordModelObj = ForgotPasswordModel().obs;
@override
void onClose() {
super.onClose();
emailController.dispose();
}
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib | mirrored_repositories/Evyan-Todo-App/lib/localization/app_localization.dart | import 'package:get/get.dart';
import 'en_us/en_us_translations.dart';
class AppLocalization extends Translations {
@override
Map<String, Map<String, String>> get keys => {'en_US': enUs};
}
| 0 |
mirrored_repositories/Evyan-Todo-App/lib/localization | mirrored_repositories/Evyan-Todo-App/lib/localization/en_us/en_us_translations.dart | final Map<String, String> enUs = {
// Login or SignUp Screen
"lbl_get_in_through": "Get in through",
"msg_our_community_is":
"our community is ready to help you to join our best platform",
"msg_welcome_to_our_community": "Welcome to our community",
// SignUp Screen
"lbl_e_mail": "E-mail",
"lbl_first_name": "First name",
"lbl_last_name": "Last name",
"msg_already_have_an": "Already have an account?",
"msg_our_community_is2":
"Our community is always there 24 hours if you need it, don't hesitate to join",
"msg_when_community_comes": "When community comes unity",
// Login Screen
"lbl_email2": "Email",
"lbl_signup2": "SignUp",
"msg_don_t_have_an_account": "Don’t have an account?",
"msg_forgot_password": "Forgot Password?",
"msg_our_community_is3":
"Our community is your community too so let's strengthen our community together",
"msg_this_is_your_community":
"this is your community, help them to grow more",
// Forgot Password Screen
"lbl_forgot_password": "Forgot Password",
"lbl_start": "Start",
"lbl_your_email": "Your Email",
"msg_helping_others_means": "Helping others means helping yourself. ",
"msg_if_you_are_always":
"If you are always helping others you are helping yourself too",
// Home Screen
"lbl_adalah": "Adalah",
"lbl_setting": "Setting",
"lbl_work_today_s": "Work Today's",
"msg_joined_6_month_ago": "Joined 6 Month Ago",
// Personality Screen
"lbl_28_may_2002": "28 May 2002|",
"lbl_adalahalcana": "AdalahAlcana|",
"lbl_change_save": "Change save",
"lbl_country": "Country",
"lbl_date_of_birth": "Date of birth",
"lbl_edit_photo": "Edit Photo",
"lbl_first_name2": "First Name",
"lbl_fourta": "Fourta|",
"lbl_hobby": "Hobby",
"lbl_indonesian": "Indonesian|",
"lbl_last_name2": "Last Name",
"lbl_sleep": "Sleep|",
"lbl_username": "UserName",
// Work Today Screen
"lbl_02_april_2021": "02 April 2021",
"lbl_today": "Today",
"lbl_work_today_s2": "Work Today’s",
"msg_create_action_plan": "Create Action Plan",
"msg_research_product": "Research Product",
// Wish List Screen
"lbl_attachments": "Attachments",
"lbl_date": "Date",
"lbl_maximum_10_mb": "maximum 10 mb",
"lbl_task_todo": "Task todo",
"lbl_tt_mm_yy": "tt/mm/yy",
"msg_create_action_mobile": "Create Action Mobile",
// Settings Screen
"lbl_log_out": "Log Out", "lbl_settings": "Settings",
// Language Screen
"lbl_english": "English", "lbl_indonesian2": "Indonesian", "lbl_save": "Save",
// TermsAndConditions Screen
"msg_lorem_ipsum_dolor2":
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla fermentum netus amet risus commodo amet vulputate tellus. Et quis ornare sed diam in. Id nibh mattis quis fermentum non malesuada. Vel ullamcorper lacus, mollis pellentesque egestas aliquet aliquam. Risus lorem velit, nunc id ornare diam. Odio diam egestas vulputate tristique mi aliquam eget. Feugiat mi sed semper faucibus tellus aliquam nulla ullamcorper arcu. Est in risus pulvinar arcu pretium dui eget pretium. Nunc, sed scelerisque id varius.\nVulputate vel aliquam suscipit vitae, nullam pretium. Ut sed elementum eget id pellentesque. Odio placerat faucibus purus rhoncus, pharetra commodo. Augue a duis vitae tempor lobortis. Aliquam nunc amet fermentum, aliquet elementum ac neque, convallis. Fames nulla ornare diam odio enim. Enim, pellentesque ",
// Common String
"lbl_alcanasatre": "Alcanasatre",
"lbl_language": "Language",
"lbl_login": "Login",
"lbl_next": "Next",
"lbl_password": "Password",
"lbl_personality": "Personality",
"lbl_sign_up": "Sign Up",
"msg_lorem_ipsum_dolor":
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"msg_make_a_wish_list": "Make a wish list",
"msg_make_your_job_easier": "Make your job easier with our reminders",
"msg_terms_and_conditions": "Terms and Conditions",
"msg_your_settings_so": "Your settings so that we are comfortable",
// Network Error String
"msg_network_err": "Network Error",
"msg_something_went_wrong": "Something Went Wrong!",
// Validation Error String
"err_msg_please_enter_valid_text": "Please enter valid text",
"err_msg_please_enter_valid_email": "Please enter valid email",
"err_msg_please_enter_valid_password": "Please enter valid password",
};
| 0 |
mirrored_repositories/Evyan-Todo-App | mirrored_repositories/Evyan-Todo-App/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:todo_app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/JasonParsing-App/json_parsing_project | mirrored_repositories/JasonParsing-App/json_parsing_project/lib/home_page.dart | import'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'dart:async';
import'Model/Data.dart';
import 'Detailpage.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
List<MaterialColor>_color=[Colors.deepOrange,Colors.blue,Colors.yellow,Colors.green,Colors.brown,Colors.pink,Colors.deepPurple,Colors.red];
Future<List<Data>> getAllData() async{
var api="https://jsonplaceholder.typicode.com/photos";
var data=await http.get(api);
var jsonData=json.decode(data.body);
List<Data>listOf=[];
for (var i in jsonData){
Data data=Data(i["id"],i["title"],i["url"],i["thumbnailurl"]);
listOf.add(data);
}
return listOf;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Json Parsing App"),
actions: <Widget>[
IconButton(
icon:Icon(Icons.search),
onPressed: (){
debugPrint('Search');
}),
IconButton(icon: Icon(Icons.add),
onPressed: (){
debugPrint("add");
})
],
),
drawer: Drawer(
child:ListView(
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text("Jaffa"),
accountEmail: Text("[email protected]"),
decoration: BoxDecoration(
color: Colors.blue
),
),
ListTile(
title: Text("first page"),
leading: Icon(Icons.search,color: Colors.red,),
onTap: (){
Navigator.of(context).pop();
},
),
ListTile(
title: Text("Second page"),
leading: Icon(Icons.add,color: Colors.green,),
onTap: (){
Navigator.of(context).pop();
},
),
ListTile(
title: Text("third page"),
leading: Icon(Icons.title,color: Colors.blue,),
onTap: (){
Navigator.of(context).pop();
},
),
ListTile(
title: Text("first page"),
leading: Icon(Icons.list,color: Colors.yellow,),
onTap: (){
Navigator.of(context).pop();
},
),
Divider(
height: 7.0,
),
ListTile(
title: Text("close"),
leading: Icon(Icons.close,color: Colors.red,),
onTap: (){
Navigator.of(context).pop();
},
)
],
),
),
body: ListView(
children: <Widget>[
Container(
margin: EdgeInsets.all(10.0),
height: 250.0,
child: FutureBuilder(
future: getAllData(),
builder:(BuildContext c,AsyncSnapshot snapshot){
if(snapshot.data==null){
return Center(
child: Text("Loading Data......."),
);
}else{
return ListView.builder(
itemCount: snapshot.data.length,
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext c,int index){
MaterialColor mColor=_color[index % _color.length];
return Card(
elevation: 10.0,
child: Column(
children: <Widget>[
Image.network(snapshot.data[index].url,
height: 150.0,
width: 150.0,
fit: BoxFit.cover,
),
SizedBox(height: 7.0,),
Container(
margin: EdgeInsets.all(6.0),
height: 50.0,
child:Row(
children: <Widget>[
Container(
child:CircleAvatar(
child: Text(snapshot.data[index].id.toString()),
backgroundColor: mColor,
foregroundColor: Colors.white,
),
),
SizedBox(
width: 6.0,
),
Container(
width: 80.0,
child: Text(snapshot.data[index].title,
maxLines: 1
),
)
],
),
)
],
),
);
},
);
}
}
),
),
SizedBox(height: 7.0,),
Container(
margin: EdgeInsets.all(10.0),
height: MediaQuery.of(context).size.height,
child: FutureBuilder(
future: getAllData(),
builder:(BuildContext c, AsyncSnapshot snapshot){
if (snapshot.data==null){
return Center(
child:Text("Loading Data.....") ,
);
}else{
return ListView.builder(
itemCount: snapshot.data.length,
itemBuilder:(BuildContext c,int index){
MaterialColor mColor=_color[index % _color.length];
return Card(
elevation: 7.0,
child: Container(
height: 80.0,
child: Row(
children: <Widget>[
Expanded(
flex: 1,
child:Image.network(
snapshot.data[index].url,
height: 60.0,
fit: BoxFit.cover,
),
),
SizedBox(width: 6.0,),
Expanded(
flex: 2,
child:InkWell(
child: Text(
snapshot.data[index].title,
maxLines: 2,
style: TextStyle(
fontSize: 16.0,
),
),
onTap: (){
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext c)=>Detail(snapshot.data[index])));
},
) ),
Expanded(
flex: 1,
child:Align(
alignment: Alignment.center,
child: CircleAvatar(
child: Text(snapshot.data[index].id.toString()),
backgroundColor: mColor,
foregroundColor: Colors.white,
),
) )
],
),
),
);
}
);
}
}),
)
],
),
);
}
}
| 0 |
mirrored_repositories/JasonParsing-App/json_parsing_project | mirrored_repositories/JasonParsing-App/json_parsing_project/lib/Detailpage.dart | import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'Model/Data.dart';
class Detail extends StatefulWidget {
Data data;
Detail(this.data);
@override
_DetailState createState() => _DetailState();
}
class _DetailState extends State<Detail> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Detail Data"),
backgroundColor: Colors.deepPurple,
),
body: ListView(
children: <Widget>[
Container(
margin: EdgeInsets.all(5.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Image.network(
widget.data.url,
height: 250.0,
width: MediaQuery.of(context).size.width,
fit: BoxFit.cover,
),
SizedBox(height: 10.0,),
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
flex: 1,
child:CircleAvatar(
child: Text(widget.data.id.toString()),
) ),
SizedBox(height: 10.0,),
Expanded(
flex: 2,
child:Text(widget.data.toString()) )
],
),
)
],
),
)
],
),
);
}
}
| 0 |
mirrored_repositories/JasonParsing-App/json_parsing_project | mirrored_repositories/JasonParsing-App/json_parsing_project/lib/main.dart | import'package:flutter/material.dart';
import 'home_page.dart';
void main(){
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home:HomePage(),
)
);
} | 0 |
mirrored_repositories/JasonParsing-App/json_parsing_project/lib | mirrored_repositories/JasonParsing-App/json_parsing_project/lib/Model/Data.dart | class Data {
int id;
String title;
String url;
String thumbnailurl;
Data(this.id, this.title, this.url, this.thumbnailurl);
} | 0 |
mirrored_repositories/JasonParsing-App/json_parsing_project | mirrored_repositories/JasonParsing-App/json_parsing_project/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:json_parsing_project/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/flutter-weekly-chart | mirrored_repositories/flutter-weekly-chart/lib/stat_controller.dart | import 'dart:math';
import 'package:get/get.dart';
import 'package:weeklygraph/util/date_util.dart';
import 'data/daily_stat_ui_model.dart';
class StatController extends GetxController {
RxString todayStat = "".obs;
RxString currentWeek = "".obs;
RxList<DailyStatUiModel> dailyStatList1 = (List<DailyStatUiModel>.of([])).obs;
RxList<DailyStatUiModel> dailyStatList2 = (List<DailyStatUiModel>.of([])).obs;
RxList<DailyStatUiModel> dailyStatList3 = (List<DailyStatUiModel>.of([])).obs;
RxBool displayNextWeekBtn = false.obs;
//mock stat data is set to positive number, so the max value is initialize as negative
int maxSection1 = -1;
int maxSection2 = -1;
int maxSection3 = -1;
DateTime selectedDate = DateTime.now();
DateTime currentDate = DateTime.now();
@override
void onInit() {
setCurrentWeek();
super.onInit();
}
void resetMaxValue() {
maxSection1 = -1;
maxSection2 = -1;
maxSection3 = -1;
}
void setCurrentWeek() async {
selectedDate = DateTime.now();
currentWeek.value = getWeekDisplayDate(selectedDate);
getDailyStatList(selectedDate);
}
void setPreviousWeek() {
selectedDate = selectedDate.subtract(Duration(days: 7));
setNextWeekButtonVisibility();
currentWeek.value = getWeekDisplayDate(selectedDate);
getDailyStatList(selectedDate);
}
void setNextWeek() {
selectedDate = selectedDate.add(Duration(days: 7));
setNextWeekButtonVisibility();
currentWeek.value = getWeekDisplayDate(selectedDate);
getDailyStatList(selectedDate);
}
void setNextWeekButtonVisibility() {
displayNextWeekBtn.value = !selectedDate.isSameDate(currentDate);
}
String getWeekDisplayDate(DateTime dateTime) {
return '${AppDateUtils.firstDateOfWeek(dateTime).toFormatString('dd MMM')} - ${AppDateUtils.lastDateOfWeek(dateTime).toFormatString('dd MMM')}';
}
Future<void> getDailyStatList(DateTime dateTime) async {
resetMaxValue();
var daysInWeek = AppDateUtils.getDaysInWeek(dateTime);
List<DailyStatUiModel> section1Stat = List.filled(7, defaultDailyStat);
List<DailyStatUiModel> section2Stat = List.filled(7, defaultDailyStat);
List<DailyStatUiModel> section3Stat = List.filled(7, defaultDailyStat);
var today = DateTime.now();
var todayPosition = DateTime.now().weekday - 1;
for (var i = 0; i <= 6; i++) {
var date = daysInWeek[i];
var randomStat1 = randomInt(100);
section1Stat[i] = DailyStatUiModel(
day: date.toFormatString('EEE'),
stat: randomStat1,
isToday: today.isSameDate(date),
isSelected: todayPosition == i,
dayPosition: i);
if (maxSection1 < randomStat1) {
maxSection1 = randomStat1;
}
var randomStat2 = randomInt(100);
section2Stat[i] = DailyStatUiModel(
day: date.toFormatString('EEE'),
stat: randomStat2,
isToday: today.isSameDate(date),
isSelected: todayPosition == i,
dayPosition: i);
if (maxSection2 < randomStat1) {
maxSection2 = randomStat2;
}
var randomStat3 = randomInt(100);
section3Stat[i] = DailyStatUiModel(
day: date.toFormatString('EEE'),
stat: randomStat3,
isToday: today.isSameDate(date),
isSelected: todayPosition == i,
dayPosition: i);
if (maxSection3 < randomStat1) {
maxSection3 = randomStat3;
}
dailyStatList1.assignAll(section1Stat);
dailyStatList2.assignAll(section2Stat);
dailyStatList3.assignAll(section3Stat);
}
}
int randomInt(int max) {
return Random().nextInt(100) + 1;
}
void setSelectedDayPosition(int position, int sectionNumber) {
switch (sectionNumber) {
case 1:
{
dailyStatList1.assignAll(getDailyListWithSelectedDay(
dailyStatList1.call(),
position,
));
break;
}
case 2:
{
dailyStatList2.assignAll(getDailyListWithSelectedDay(
dailyStatList2.call(),
position,
));
break;
}
case 3:
{
dailyStatList3.assignAll(getDailyListWithSelectedDay(
dailyStatList3.call(),
position,
));
break;
}
}
}
List<DailyStatUiModel> getDailyListWithSelectedDay(
List<DailyStatUiModel> list, int position) {
return list
.map((e) => e.copyWith(isSelected: e.dayPosition == position))
.toList();
}
double getStatPercentage(int time, int type) {
switch (type) {
case 1:
{
return getSection1StatPercentage(time);
}
case 2:
{
return getSection2StatPercentage(time);
}
case 3:
{
return getSection3StatPercentage(time);
}
default:
return 0.0;
}
}
double getSection3StatPercentage(int time) {
if (time == 0) {
return 0;
} else {
return time / maxSection3;
}
}
double getSection2StatPercentage(int time) {
if (time == 0) {
return 0;
} else {
return time / maxSection2;
}
}
double getSection1StatPercentage(int time) {
if (time == 0) {
return 0;
} else {
return time / maxSection1;
}
}
void onNextWeek() {
setNextWeek();
}
void onPreviousWeek() {
setPreviousWeek();
}
}
| 0 |
mirrored_repositories/flutter-weekly-chart | mirrored_repositories/flutter-weekly-chart/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:get/get.dart';
import 'package:weeklygraph/stat_controller.dart';
import 'package:weeklygraph/theme/app_theme.dart';
import 'data/daily_stat_ui_model.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GetMaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Weekly Graph',
theme: appThemeData,
home: NeumorphicTheme(theme: neumorphicTheme, child: MyHomePage()),
);
}
}
class MyHomePage extends StatelessWidget {
var statController = Get.put(StatController());
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: NeumorphicAppBar(
iconTheme: IconThemeData(
color: NeumorphicTheme.defaultTextColor(
context), //change your color here
),
centerTitle: true,
title: Text(
'Statistic',
style: Theme.of(context).textTheme.headline2,
textAlign: TextAlign.center,
),
actions: <Widget>[
NeumorphicButton(
child: Icon(
Icons.info_outline,
color: Theme.of(context).highlightColor,
),
onPressed: () {
//TODO add action
},
),
],
),
body: Stack(
children: [
SingleChildScrollView(
child: _buildGraphStat(),
),
_pageIndicatorText(),
_previousWeekButton(),
_nextWeekButton(),
],
),
);
}
Widget _buildGraphStat() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_buildSectionTitle(
'First Section',
'unit',
),
Obx(
() => _buildWeekIndicators(statController.dailyStatList1.call(), 1),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Divider(),
),
_buildSectionTitle(
'Second Section',
'unit',
),
Obx(
() => _buildWeekIndicators(statController.dailyStatList2.call(), 2),
),
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Divider(),
),
_buildSectionTitle(
'Third Section',
'unit',
),
Obx(
() => _buildWeekIndicators(statController.dailyStatList3.call(), 3),
),
SizedBox(
height: 64.0,
)
],
);
}
Widget _pageIndicatorText() {
return Obx(() => Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
color: Theme.of(Get.context!).primaryColor,
),
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
child: Text(
statController.currentWeek.value,
style: Theme.of(Get.context!).textTheme.bodyText1!.copyWith(
color: Colors.white,
fontSize: 17.0,
),
),
),
),
)));
}
Widget _previousWeekButton() {
return Align(
alignment: Alignment.bottomLeft,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: RawMaterialButton(
onPressed: () {
statController.onPreviousWeek();
},
elevation: 2.0,
fillColor: Theme.of(Get.context!).primaryColor,
child: Icon(
Icons.arrow_back_ios_rounded,
color: Colors.white,
),
padding: EdgeInsets.all(8.0),
shape: CircleBorder(),
),
),
);
}
Widget _nextWeekButton() {
return Obx(
() => Visibility(
visible: statController.displayNextWeekBtn.value,
child: Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: RawMaterialButton(
onPressed: () {
statController.onNextWeek();
},
elevation: 2.0,
fillColor: Theme.of(Get.context!).primaryColor,
child: Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.white,
),
padding: EdgeInsets.all(8.0),
shape: CircleBorder(),
),
),
),
),
);
}
Widget _buildSectionTitle(String title, String subTitle) {
return Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Expanded(
child: Text(
title,
style: Theme.of(Get.context!).textTheme.headline3,
),
),
Text(
subTitle,
style: Theme.of(Get.context!).textTheme.bodyText1,
)
],
),
);
}
Widget _buildWeekIndicators(List<DailyStatUiModel> models, int type) {
if (models.length == 7) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: SizedBox(
height: 152,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
_buildDayIndicator(models[0], type),
_buildDayIndicator(models[1], type),
_buildDayIndicator(models[2], type),
_buildDayIndicator(models[3], type),
_buildDayIndicator(models[4], type),
_buildDayIndicator(models[5], type),
_buildDayIndicator(models[6], type),
],
),
),
);
} else {
return Container();
}
}
Widget _buildDayIndicator(DailyStatUiModel model, int type) {
final width = 14.0;
return InkWell(
onTap: () =>
statController.setSelectedDayPosition(model.dayPosition, type),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 48.0,
height: 24.0,
child: Visibility(
visible: model.isSelected,
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
color: Theme.of(Get.context!).accentColor,
),
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 2.0),
child: Text(
'${model.stat} unit',
textAlign: TextAlign.center,
style: Theme.of(Get.context!)
.textTheme
.bodyText1!
.copyWith(fontSize: 12.0, color: Colors.white),
),
),
),
),
),
),
SizedBox(
height: 4.0,
),
Expanded(
child: NeumorphicIndicator(
width: width,
percent: statController.getStatPercentage(model.stat, type),
),
),
SizedBox(height: 8.0),
DecoratedBox(
decoration: _getDayDecoratedBox(model.isToday),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: Text(
model.day,
style: Theme.of(Get.context!).textTheme.bodyText1!.copyWith(
fontSize: 13,
color: model.isToday
? Theme.of(Get.context!).splashColor
: Theme.of(Get.context!).primaryColor,
),
),
),
)
],
),
);
}
_getDayDecoratedBox(bool isToday) {
if (isToday) {
return BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
color: Theme.of(Get.context!).primaryColor,
);
} else {
return BoxDecoration();
}
}
}
| 0 |
mirrored_repositories/flutter-weekly-chart/lib | mirrored_repositories/flutter-weekly-chart/lib/data/daily_stat_ui_model.dart | var defaultDailyStat = DailyStatUiModel(
day: 'day',
stat: 0,
isToday: false,
isSelected: false,
dayPosition: 1,
);
class DailyStatUiModel {
String day;
int stat;
bool isToday;
bool isSelected;
int dayPosition;
DailyStatUiModel(
{required this.day,
required this.stat,
required this.isToday,
required this.isSelected,
required this.dayPosition});
DailyStatUiModel copyWith(
{String? day,
int? stat,
bool? isToday,
bool? isSelected,
int? dayPosition}) =>
DailyStatUiModel(
day: day ?? this.day,
stat: stat ?? this.stat,
isToday: isToday ?? this.isToday,
isSelected: isSelected ?? this.isSelected,
dayPosition: dayPosition ?? this.dayPosition);
}
| 0 |
mirrored_repositories/flutter-weekly-chart/lib | mirrored_repositories/flutter-weekly-chart/lib/util/date_util.dart | import 'package:intl/intl.dart';
class AppDateUtils {
static DateTime firstDateOfWeek(DateTime dateTime) {
return dateTime.subtract(Duration(days: dateTime.weekday - 1));
}
static DateTime lastDateOfWeek(DateTime dateTime) {
return dateTime
.add(Duration(days: DateTime.daysPerWeek - dateTime.weekday));
}
static List<DateTime> getDaysInWeek(DateTime dateTime) {
var days = List<DateTime>.filled(7, DateTime.fromMillisecondsSinceEpoch(0));
var firstDay = firstDateOfWeek(dateTime);
for (var i = 0; i <= 6; i++) {
days[i] = firstDay.add(Duration(days: i));
}
return days;
}
}
extension DateExtension on DateTime {
String toFormatString(String format) => DateFormat(format).format(this);
bool isSameDate(DateTime other) {
return this.year == other.year &&
this.month == other.month &&
this.day == other.day;
}
}
| 0 |
mirrored_repositories/flutter-weekly-chart/lib | mirrored_repositories/flutter-weekly-chart/lib/theme/app_theme.dart | import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:google_fonts/google_fonts.dart';
import 'app_color.dart';
final ThemeData appThemeData = ThemeData(
primaryColor: kDefaultTextColor,
accentColor: kAccentColor,
splashColor: kLightestGrey,
highlightColor: kLightGrey,
scaffoldBackgroundColor: kBaseColor,
textTheme: _textTheme,
iconTheme: IconThemeData(
color: kDefaultTextColor,
),
);
final _textTheme = GoogleFonts.kanitTextTheme(TextTheme(
headline1: TextStyle(
fontSize: 34, fontWeight: FontWeight.bold, color: kDefaultTextColor),
headline2: TextStyle(
fontSize: 28, fontWeight: FontWeight.bold, color: kDefaultTextColor),
headline3: TextStyle(
fontSize: 24, fontWeight: FontWeight.normal, color: kDefaultTextColor),
bodyText1: TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal,
),
));
final neumorphicTheme = NeumorphicThemeData(
defaultTextColor: Color(0xFF30475E),
accentColor: Color(0xFFF05454),
variantColor: Color(0xFFFFA45B),
baseColor: Color(0xFFE8E8E8),
depth: 10,
intensity: 0.6,
lightSource: LightSource.topLeft);
| 0 |
mirrored_repositories/flutter-weekly-chart/lib | mirrored_repositories/flutter-weekly-chart/lib/theme/app_color.dart | import 'dart:ui';
const Color kDarkGrey = Color(0xff393b44);
const Color kLightGrey = Color(0xff8d93ab);
const Color kLightestGrey = Color(0xffd6e0f0);
const Color kLightText = Color(0xfff1f3f8);
const Color kDefaultTextColor = Color(0xFF30475E);
const Color kAlphaTextColor = Color(0x3230475E);
const Color kAlphaPrimary80 = Color(0xCC30475E);
const Color kAccentColor = Color(0xFFF05454);
const Color kIndicatorAccentColor = Color(0xFFFF4646);
const Color kIndicatorAccentVariantColor = Color(0xFFFF8585);
const Color kVariantColor = Color(0xFF222831);
const Color kBaseColor = Color(0xFFE8E8E8);
| 0 |
mirrored_repositories/flutter-weekly-chart | mirrored_repositories/flutter-weekly-chart/test/widget_test.dart | // This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:weeklygraph/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
| 0 |
mirrored_repositories/flutter_grocery_app | mirrored_repositories/flutter_grocery_app/lib/main.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'app/data/local/my_shared_pref.dart';
import 'app/routes/app_pages.dart';
import 'config/theme/my_theme.dart';
import 'config/translations/localization_service.dart';
Future<void> main() async {
// wait for bindings
WidgetsFlutterBinding.ensureInitialized();
// init shared preference
await MySharedPref.init();
runApp(
ScreenUtilInit(
designSize: const Size(390, 844),
minTextAdapt: true,
splitScreenMode: true,
useInheritedMediaQuery: true,
rebuildFactor: (old, data) => true,
builder: (context, widget) {
return GetMaterialApp(
title: "Grocery App",
useInheritedMediaQuery: true,
debugShowCheckedModeBanner: false,
builder: (context,widget) {
bool themeIsLight = MySharedPref.getThemeIsLight();
return Theme(
data: MyTheme.getThemeData(isLight: themeIsLight),
child: MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: widget!,
),
);
},
initialRoute: AppPages.INITIAL, // first screen to show when app is running
getPages: AppPages.routes, // app screens
locale: MySharedPref.getCurrentLocal(), // app language
translations: LocalizationService.getInstance(), // localization services in app (controller app language)
);
},
),
);
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/routes/app_routes.dart | part of 'app_pages.dart';
// DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart
abstract class Routes {
Routes._();
static const SPLASH = _Paths.SPLASH;
static const BASE = _Paths.BASE;
static const HOME = _Paths.HOME;
static const CART = _Paths.CART;
static const PRODUCT_DETAILS = _Paths.PRODUCT_DETAILS;
static const WELCOME = _Paths.WELCOME;
static const CATEGORY = _Paths.CATEGORY;
static const CALENDAR = _Paths.CALENDAR;
static const PROFILE = _Paths.PROFILE;
static const PRODUCTS = _Paths.PRODUCTS;
}
abstract class _Paths {
_Paths._();
static const SPLASH = '/splash';
static const WELCOME = '/welcome';
static const BASE = '/base';
static const HOME = '/home';
static const CART = '/cart';
static const PRODUCT_DETAILS = '/product-details';
static const CATEGORY = '/category';
static const CALENDAR = '/calendar';
static const PROFILE = '/profile';
static const PRODUCTS = '/products';
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/routes/app_pages.dart | import 'package:get/get.dart';
import '../modules/base/bindings/base_binding.dart';
import '../modules/base/views/base_view.dart';
import '../modules/calendar/bindings/calendar_binding.dart';
import '../modules/calendar/views/calendar_view.dart';
import '../modules/cart/bindings/cart_binding.dart';
import '../modules/cart/views/cart_view.dart';
import '../modules/category/bindings/category_binding.dart';
import '../modules/category/views/category_view.dart';
import '../modules/home/bindings/home_binding.dart';
import '../modules/home/views/home_view.dart';
import '../modules/product_details/bindings/product_details_binding.dart';
import '../modules/product_details/views/product_details_view.dart';
import '../modules/products/bindings/products_binding.dart';
import '../modules/products/views/products_view.dart';
import '../modules/profile/bindings/profile_binding.dart';
import '../modules/profile/views/profile_view.dart';
import '../modules/splash/bindings/splash_binding.dart';
import '../modules/splash/views/splash_view.dart';
import '../modules/welcome/bindings/welcome_binding.dart';
import '../modules/welcome/views/welcome_view.dart';
part 'app_routes.dart';
class AppPages {
AppPages._();
static const INITIAL = Routes.SPLASH;
static final routes = [
GetPage(
name: _Paths.SPLASH,
page: () => const SplashView(),
binding: SplashBinding(),
),
GetPage(
name: _Paths.WELCOME,
page: () => const WelcomeView(),
binding: WelcomeBinding(),
),
GetPage(
name: _Paths.BASE,
page: () => const BaseView(),
binding: BaseBinding(),
),
GetPage(
name: _Paths.HOME,
page: () => const HomeView(),
binding: HomeBinding(),
),
GetPage(
name: _Paths.CART,
page: () => const CartView(),
binding: CartBinding(),
),
GetPage(
name: _Paths.PRODUCT_DETAILS,
page: () => const ProductDetailsView(),
binding: ProductDetailsBinding(),
transition: Transition.rightToLeft,
transitionDuration: const Duration(milliseconds: 250),
),
GetPage(
name: _Paths.CATEGORY,
page: () => const CategoryView(),
binding: CategoryBinding(),
),
GetPage(
name: _Paths.CALENDAR,
page: () => const CalendarView(),
binding: CalendarBinding(),
),
GetPage(
name: _Paths.PROFILE,
page: () => const ProfileView(),
binding: ProfileBinding(),
),
GetPage(
name: _Paths.PRODUCTS,
page: () => const ProductsView(),
binding: ProductsBinding(),
),
];
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/custom_button.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class CustomButton extends StatelessWidget {
final String text;
final Color? foregroundColor;
final Color? backgroundColor;
final double? radius;
final double? fontSize;
final Gradient? gradient;
final void Function()? onPressed;
final FontWeight? fontWeight;
final double? spacing;
final Widget? icon;
final Color? borderColor;
final bool hasShadow;
final Color? shadowColor;
final double shadowOpacity;
final double shadowBlurRadius;
final double shadowSpreadRadius;
final double? width;
final double? verticalPadding;
final bool disabled;
const CustomButton({
Key? key,
this.icon,
this.spacing,
required this.text,
required this.onPressed,
this.fontWeight,
this.gradient,
this.backgroundColor,
this.fontSize,
this.foregroundColor,
this.radius,
this.borderColor,
this.hasShadow = true,
this.shadowColor,
this.shadowOpacity = 0.3,
this.shadowBlurRadius = 3,
this.shadowSpreadRadius = 1,
this.width,
this.verticalPadding,
this.disabled = false,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
elevation: 0,
borderRadius: BorderRadius.circular(radius ?? 5.r),
child: Container(
padding: hasShadow ? EdgeInsets.all(5.r) : EdgeInsets.zero,
child: InkWell(
borderRadius: BorderRadius.circular(radius ?? 5.r),
onTap: !disabled ? onPressed : null,
child: Ink(
width: width ?? double.infinity,
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: verticalPadding ?? 14.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(radius ?? 10.r),
border: Border.all(color: borderColor ?? Colors.transparent),
color: !disabled ? backgroundColor ?? Get.theme.primaryColor : Get.theme.primaryColor.withOpacity(0.5),
gradient: gradient,
boxShadow: !hasShadow || disabled
? null
: [
BoxShadow(
color: ( shadowColor ?? Colors.black).withOpacity(shadowOpacity),
spreadRadius: shadowSpreadRadius,
blurRadius: shadowBlurRadius,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
text,
style: Get.theme.textTheme.bodyText1?.copyWith(
fontSize: fontSize,
fontWeight: fontWeight,
color: foregroundColor ?? Colors.white,
),
),
if (icon != null)
SizedBox(
width: spacing ?? 10.w,
),
if (icon != null) icon!
],
),
),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/dark_transition.dart | import 'dart:math';
import 'package:flutter/material.dart';
import '../../config/theme/my_theme.dart';
class DarkTransition extends StatefulWidget {
const DarkTransition({
required this.builder,
Key? key,
this.offset = Offset.zero,
this.themeController,
this.radius,
this.duration = const Duration(milliseconds: 500),
this.isDark = false
}) : super(key: key);
/// Deinfe the widget that will be transitioned
/// int index is either 1 or 2 to identify widgets, 2 is the top widget
final Widget Function(BuildContext, int) builder;
/// the current state of the theme
final bool isDark;
/// optional animation controller to controll the animation
final AnimationController? themeController;
/// centeral point of the circular transition
final Offset offset;
/// optional radius of the circle defaults to [max(height,width)*1.5])
final double? radius;
/// duration of animation defaults to 400ms
final Duration? duration;
@override
_DarkTransitionState createState() => _DarkTransitionState();
}
class _DarkTransitionState extends State<DarkTransition>
with SingleTickerProviderStateMixin {
@override
void dispose() {
_darkNotifier.dispose();
super.dispose();
}
final _darkNotifier = ValueNotifier<bool>(false);
@override
void initState() {
super.initState();
if (widget.themeController == null) {
_animationController =
AnimationController(vsync: this, duration: widget.duration);
} else {
_animationController = widget.themeController!;
}
}
double _radius(Size size) {
final maxVal = max(size.width, size.height);
return maxVal * 1.5;
}
late AnimationController _animationController;
double x = 0;
double y = 0;
bool isDark = false;
bool isDarkVisible = false;
late double radius;
Offset position = Offset.zero;
ThemeData getTheme(bool dark) {
return MyTheme.getThemeData(isLight: !dark);
}
@override
void didUpdateWidget(DarkTransition oldWidget) {
super.didUpdateWidget(oldWidget);
_darkNotifier.value = widget.isDark;
if (widget.isDark != oldWidget.isDark) {
if (isDark) {
_animationController.reverse();
_darkNotifier.value = false;
} else {
_animationController.reset();
_animationController.forward();
_darkNotifier.value = true;
}
position = widget.offset;
}
if (widget.radius != oldWidget.radius) {
_updateRadius();
}
if (widget.duration != oldWidget.duration) {
_animationController.duration = widget.duration;
}
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
_updateRadius();
}
void _updateRadius() {
final size = MediaQuery.of(context).size;
if (widget.radius == null) {
radius = _radius(size);
} else {
radius = widget.radius!;
}
}
@override
Widget build(BuildContext context) {
isDark = _darkNotifier.value;
Widget _body(int index) {
return ValueListenableBuilder<bool>(
valueListenable: _darkNotifier,
builder: (BuildContext context, bool isDark, Widget? child) {
return Theme(
data: index == 2
? getTheme(!isDarkVisible)
: getTheme(isDarkVisible),
child: widget.builder(context, index)
);
},
);
}
return AnimatedBuilder(
animation: _animationController,
builder: (BuildContext context, Widget? child) {
return Stack(
children: [
_body(1),
ClipPath(
clipper: CircularClipper(
_animationController.value * radius, position,
),
child: _body(2),
),
],
);
}
);
}
}
class CircularClipper extends CustomClipper<Path> {
const CircularClipper(this.radius, this.center);
final double radius;
final Offset center;
@override
Path getClip(Size size) {
final Path path = Path();
path.addOval(Rect.fromCircle(radius: radius, center: center));
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return true;
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/custom_snackbar.dart | import 'package:flutter/material.dart';
import 'package:get/get.dart';
class CustomSnackBar {
static showCustomSnackBar({required String title, required String message, Duration? duration}) {
Get.snackbar(
title,
message,
duration: duration ?? const Duration(seconds: 3),
margin: const EdgeInsets.only(top: 10, left: 10, right: 10),
colorText: Colors.white,
backgroundColor: const Color(0xFF3A3A3A),
icon: const Icon(Icons.check, color: Colors.greenAccent),
);
}
static showCustomErrorSnackBar({required String title, required String message, Color? color, Duration? duration}) {
Get.snackbar(
title,
message,
duration: duration ?? const Duration(seconds: 3),
margin: const EdgeInsets.only(top: 10,left: 10,right: 10),
colorText: Colors.white,
backgroundColor: color ?? Colors.redAccent,
icon: const Icon(Icons.error, color: Colors.white,),
);
}
static showCustomToast({String? title, required String message, Color? color, Duration? duration}) {
Get.rawSnackbar(
title: title,
duration: duration ?? const Duration(seconds: 3),
snackStyle: SnackStyle.GROUNDED,
backgroundColor: color ?? Colors.green,
onTap: (snack){
Get.closeAllSnackbars();
},
//overlayBlur: 0.8,
message: message,
);
}
static showCustomErrorToast({String? title, required String message, Color? color,Duration? duration}) {
Get.rawSnackbar(
title: title,
duration: duration ?? const Duration(seconds: 3),
snackStyle: SnackStyle.GROUNDED,
backgroundColor: color ?? Colors.redAccent,
onTap: (snack){
Get.closeAllSnackbars();
},
//overlayBlur: 0.8,
message: message,
);
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/product_count_item.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import '../../utils/constants.dart';
import '../data/models/product_model.dart';
import '../modules/base/controllers/base_controller.dart';
import 'custom_icon_button.dart';
class ProductCountItem extends GetView<BaseController> {
final ProductModel product;
const ProductCountItem({
Key? key,
required this.product
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.theme;
return Row(
children: [
CustomIconButton(
width: 36.w,
height: 36.h,
onPressed: () => controller.onDecreasePressed(product.id),
icon: SvgPicture.asset(
Constants.removeIcon,
fit: BoxFit.none,
),
backgroundColor: theme.cardColor,
),
16.horizontalSpace,
GetBuilder<BaseController>(
id: 'ProductQuantity',
builder: (_) => Text(
product.quantity.toString(),
style: theme.textTheme.headline4,
),
),
16.horizontalSpace,
CustomIconButton(
width: 36.w,
height: 36.h,
onPressed: () => controller.onIncreasePressed(product.id),
icon: SvgPicture.asset(
Constants.addIcon,
fit: BoxFit.none,
),
backgroundColor: theme.primaryColor,
),
],
);
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/no_data.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../utils/constants.dart';
class NoData extends StatelessWidget {
final String? text;
const NoData({Key? key, this.text}) : super(key: key);
@override
Widget build(BuildContext context) {
return Center(
child: Column(
children: [
80.verticalSpace,
Image.asset(Constants.logo, width: 313.w, height: 260.h,),
20.verticalSpace,
Text(text ?? 'No Data', style: context.textTheme.headline4),
],
),
);
}
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/custom_card.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class CustomCard extends StatelessWidget {
final String title;
final String subtitle;
final String icon;
const CustomCard({
Key? key,
required this.title,
required this.subtitle,
required this.icon,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.theme;
return Container(
padding: EdgeInsets.fromLTRB(16.w, 12.h, 10.w, 12.h),
decoration: BoxDecoration(
color: theme.scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(16.r),
border: Border.all(color: theme.dividerColor),
),
child: Row(
children: [
Image.asset(icon),
16.horizontalSpace,
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title, style: theme.textTheme.headline5?.copyWith(
color: theme.primaryColor,
),
),
4.verticalSpace,
Text(subtitle, style: theme.textTheme.bodyText2),
],
)
],
),
);
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/custom_form_field.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../config/theme/my_fonts.dart';
import '../../config/theme/my_styles.dart';
class CustomFormField extends StatefulWidget {
final String? hint;
final String? label;
final double? labelSize;
final TextEditingController? controller;
final String? Function(String?)? validator;
final Function(String?)? onFieldSubmit;
final Function()? onEditingComplete;
final Function()? onTap;
final TextInputType? keyboardType;
final FocusNode? focusNode;
final bool? autoFocus;
final bool? obscureText;
final Widget? suffixIcon;
final Widget? prefixIcon;
final EdgeInsetsGeometry? contentPadding;
final TextInputAction? textInputAction;
final TextAlign? textAlign;
final Color? textColor;
final double? textSize;
final Color? backgroundColor;
final InputBorder? enabledBorder;
final InputBorder? focusedBorder;
final InputBorder? errorBorder;
final double? borderRound;
final Color? enabledBorderColor;
final Color? focusedBorderColor;
final int? minLines;
final int? maxLines;
final String? initialValue;
final bool? enabled;
final bool? readOnly;
final Function(String?)? onChanged;
final bool? expands;
final bool? isDense;
final Color? hintColor;
final double? hintFontSize;
final FontWeight? hintFontWeight;
final bool isDatePicker;
final DateTime? firstDate;
final DateTime? lastDate;
final void Function(String)? onDateChanged;
final Color? iconColor;
final bool isSearchField; // will show cancel prefix icon to cancel search
final Function? onCanceled; // callback for cancel (if its search field)
const CustomFormField({
Key? key,
this.hint,
this.label,
this.labelSize,
this.controller,
this.validator,
this.onFieldSubmit,
this.onEditingComplete,
this.onTap,
this.keyboardType,
this.focusNode,
this.autoFocus,
this.obscureText,
this.suffixIcon,
this.prefixIcon,
this.contentPadding,
this.backgroundColor,
this.textInputAction,
this.textAlign,
this.textColor,
this.textSize,
this.enabledBorder,
this.focusedBorder,
this.errorBorder,
this.borderRound,
this.enabledBorderColor,
this.focusedBorderColor,
this.minLines,
this.maxLines,
this.initialValue,
this.enabled,
this.readOnly,
this.onChanged,
this.expands,
this.isDense,
this.hintColor,
this.hintFontSize,
this.hintFontWeight,
this.isDatePicker = false,
this.firstDate,
this.lastDate,
this.onDateChanged,
this.iconColor,
this.isSearchField = false,
this.onCanceled,
}) : super(key: key);
@override
State<CustomFormField> createState() => _CustomFormFieldState();
}
class _CustomFormFieldState extends State<CustomFormField> {
String text = '';
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: Theme(
data: Get.theme.copyWith(
primaryColor: widget.iconColor ?? Get.theme.primaryColor,
colorScheme: Get.theme.colorScheme.copyWith(
primary: widget.iconColor ?? Get.theme.primaryColor,
)
),
child: TextFormField(
textAlign: widget.textAlign ?? TextAlign.start,
enabled: widget.enabled,
readOnly: widget.readOnly ?? false,
onTap: widget.onTap,
autofocus: widget.autoFocus ?? false,
//cursorHeight: 15,
autovalidateMode: AutovalidateMode.onUserInteraction,
initialValue: widget.initialValue,
style: MyStyles.getTextTheme(isLightTheme: Get.isDarkMode).bodyText2!.copyWith(
fontSize: widget.textSize ?? 14.sp,
color: widget.textColor ?? Colors.black.withOpacity(0.8),
),
onSaved: widget.onFieldSubmit,
onEditingComplete: widget.onEditingComplete,
onChanged: (value){
setState(() {
text = value;
});
widget.onChanged?.call(value);
},
minLines: widget.minLines,
maxLines: widget.obscureText == true ? 1 : widget.maxLines,
expands: widget.expands ?? false,
decoration: InputDecoration(
label: widget.label == null ? null : Text(widget.label ?? '', style: TextStyle(fontSize: widget.labelSize),),
suffixIcon: widget.isSearchField ? text.isEmpty ? null : GestureDetector(onTap: (){
setState(() {
widget.controller?.clear();
text = '';
widget.onCanceled?.call();
FocusScope.of(context).unfocus();
});
},child: Icon(Icons.close,color: Get.theme.iconTheme.color,)) : widget.suffixIcon,
prefixIcon: widget.prefixIcon,
contentPadding: widget.contentPadding ?? EdgeInsets.symmetric(vertical: 12.h, horizontal: 20.w),
isDense: widget.isDense,
filled: true,
fillColor: widget.backgroundColor ?? const Color(0xFFF9F9F9),
hintStyle: MyFonts.getAppFontType.copyWith(
fontSize: widget.hintFontSize ?? 14.sp,
fontWeight: widget.hintFontWeight ?? FontWeight.normal,
color: widget.hintColor ?? Colors.black.withOpacity(0.4)
),
hintText: widget.hint,
focusedErrorBorder: widget.errorBorder ?? OutlineInputBorder(borderSide: const BorderSide(color: Colors.redAccent, width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.withOpacity(0), width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
errorBorder: widget.errorBorder ?? OutlineInputBorder(borderSide: const BorderSide(color: Colors.redAccent, width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
enabledBorder: widget.enabledBorder ?? OutlineInputBorder(borderSide: BorderSide(color: widget.enabledBorder == null ? Colors.transparent : Colors.grey[300]!, width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
focusedBorder: widget.focusedBorder ?? OutlineInputBorder(
borderSide: BorderSide(color: widget.focusedBorderColor ?? Theme.of(context).primaryColor, width: 1.0),
borderRadius: BorderRadius.circular(widget.borderRound ?? 10),
),
),
validator: widget.validator,
controller: widget.controller,
onFieldSubmitted: widget.onFieldSubmit,
focusNode: widget.focusNode,
keyboardType: widget.keyboardType,
obscureText: widget.obscureText ?? false,
textInputAction: widget.textInputAction ?? TextInputAction.next,
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/category_item.dart | import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import '../data/models/category_model.dart';
import '../routes/app_pages.dart';
class CategoryItem extends StatelessWidget {
final CategoryModel category;
const CategoryItem({
Key? key,
required this.category,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.theme;
return GestureDetector(
onTap: () => Get.toNamed(Routes.PRODUCTS),
child: Column(
children: [
CircleAvatar(
radius: 37.r,
backgroundColor: theme.cardColor,
child: SvgPicture.asset(category.image),
).animate().fade(duration: 200.ms),
10.verticalSpace,
Text(category.title, style: theme.textTheme.headline6)
.animate().fade().slideY(
duration: 200.ms,
begin: 1,
curve: Curves.easeInSine,
),
],
),
);
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/custom_loading_overlay.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../config/translations/strings_enum.dart';
showLoadingOverLay({
required Future<dynamic> Function() asyncFunction,
String? msg,
}) async {
await Get.showOverlay(asyncFunction: () async {
try{
await asyncFunction();
} catch(error) {
rethrow;
}
}, loadingWidget: Center(
child: _getLoadingIndicator(msg: msg),
), opacity: 0.7,
opacityColor: Colors.black,
);
}
Widget _getLoadingIndicator({String? msg}){
return Container(
padding: EdgeInsets.symmetric(
horizontal: 20.w,
vertical: 10.h,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
color: Colors.white,
),
child: Column(mainAxisSize: MainAxisSize.min,children: [
Image.asset('assets/images/app_icon.png',height: 45.h,),
SizedBox(width: 8.h,),
Text(msg ?? Strings.loading.tr,style: Get.theme.textTheme.bodyText1),
],),
);
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/custom_icon_button.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class CustomIconButton extends StatelessWidget {
final Function()? onPressed;
final Widget? icon;
final Color? backgroundColor;
final Color? borderColor;
final double? width;
final double? height;
const CustomIconButton({
Key? key,
required this.onPressed,
required this.icon,
this.backgroundColor,
this.borderColor,
this.width,
this.height,
}) : super(key: key);
@override
Widget build(BuildContext context) {
var theme = context.theme;
return SizedBox(
width: width ?? 44.w,
height: height ?? 44.h,
child: Material(
color: backgroundColor ?? theme.backgroundColor,
shape: borderColor == null ? const CircleBorder() : CircleBorder(
side: BorderSide(color: borderColor!),
),
child: InkWell(
onTap: onPressed,
child: icon,
highlightColor: theme.primaryColor.withOpacity(0.2),
customBorder: const CircleBorder(),
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app | mirrored_repositories/flutter_grocery_app/lib/app/components/product_item.dart | import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../data/models/product_model.dart';
import '../routes/app_pages.dart';
class ProductItem extends StatelessWidget {
final ProductModel product;
const ProductItem({
Key? key,
required this.product
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.theme;
return GestureDetector(
onTap: () => Get.toNamed(Routes.PRODUCT_DETAILS, arguments: product),
child: Container(
decoration: BoxDecoration(
color: theme.cardColor,
borderRadius: BorderRadius.circular(16.r),
),
child: Stack(
children: [
Positioned(
right: 12.w,
bottom: 12.h,
child: GestureDetector(
onTap: () => Get.toNamed(
Routes.PRODUCT_DETAILS, arguments: product
),
child: CircleAvatar(
radius: 18.r,
backgroundColor: theme.primaryColor,
child: const Icon(Icons.add_rounded, color: Colors.white),
).animate().fade(duration: 200.ms),
),
),
Positioned(
top: 22.h,
left: 26.w,
right: 25.w,
child: Image.asset(product.image).animate().slideX(
duration: 200.ms,
begin: 1, curve: Curves.easeInSine,
),
),
Positioned(
left: 16.w,
bottom: 24.h,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(product.name, style: theme.textTheme.headline6)
.animate().fade().slideY(
duration: 200.ms,
begin: 1, curve: Curves.easeInSine,
),
5.verticalSpace,
Text(
'1kg, ${product.price}\$',
style: theme.textTheme.headline5?.copyWith(
color: theme.accentColor,
),
).animate().fade().slideY(
duration: 200.ms,
begin: 2, curve: Curves.easeInSine,
),
],
),
),
],
),
),
);
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app/modules/cart | mirrored_repositories/flutter_grocery_app/lib/app/modules/cart/views/cart_view.dart | import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import '../../../../utils/constants.dart';
import '../../../components/custom_button.dart';
import '../../../components/custom_icon_button.dart';
import '../../../components/no_data.dart';
import '../controllers/cart_controller.dart';
import 'widgets/cart_item.dart';
class CartView extends GetView<CartController> {
const CartView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.theme;
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomIconButton(
onPressed: () => Get.back(),
backgroundColor: theme.scaffoldBackgroundColor,
borderColor: theme.dividerColor,
icon: SvgPicture.asset(
Constants.backArrowIcon,
fit: BoxFit.none,
color: theme.appBarTheme.iconTheme?.color,
),
),
Text('Cart 🛒', style: theme.textTheme.headline3),
const Opacity(
opacity: 0.0,
child: CustomIconButton(onPressed: null, icon: Center()),
),
],
),
),
),
body: GetBuilder<CartController>(
builder: (_) => Column(
children: [
24.verticalSpace,
Expanded(
child: controller.products.isEmpty
? const NoData(text: 'No Products in Your Cart Yet!')
: ListView.separated(
separatorBuilder: (_, index) => Padding(
padding: EdgeInsets.only(top: 12.h, bottom: 24.h),
child: const Divider(thickness: 1),
),
itemCount: controller.products.length,
itemBuilder: (context, index) => CartItem(
product: controller.products[index],
).animate(delay: (100 * index).ms).fade().slideX(
duration: 300.ms,
begin: -1,
curve: Curves.easeInSine,
),
),
),
30.verticalSpace,
Visibility(
visible: controller.products.isNotEmpty,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w),
child: CustomButton(
text: 'Purchase Now',
onPressed: () => controller.onPurchaseNowPressed(),
fontSize: 16.sp,
radius: 50.r,
verticalPadding: 16.h,
hasShadow: false,
).animate().fade().slideY(
duration: 300.ms,
begin: 1,
curve: Curves.easeInSine,
),
),
),
30.verticalSpace,
],
),
),
);
}
}
| 0 |
mirrored_repositories/flutter_grocery_app/lib/app/modules/cart/views | mirrored_repositories/flutter_grocery_app/lib/app/modules/cart/views/widgets/cart_item.dart | import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../../../components/product_count_item.dart';
import '../../../../data/models/product_model.dart';
import '../../controllers/cart_controller.dart';
class CartItem extends GetView<CartController> {
final ProductModel product;
const CartItem({
Key? key,
required this.product,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = context.theme;
return Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(product.image, width: 50.w, height: 40.h),
16.horizontalSpace,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(product.name, style: theme.textTheme.headline5),
5.verticalSpace,
Text(
'1kg, ${product.price}\$',
style: theme.textTheme.headline5?.copyWith(
color: theme.accentColor,
),
),
],
),
const Spacer(),
ProductCountItem(product: product),
],
),
);
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app/modules/cart | mirrored_repositories/flutter_grocery_app/lib/app/modules/cart/controllers/cart_controller.dart | import 'package:get/get.dart';
import '../../../../utils/dummy_helper.dart';
import '../../../components/custom_snackbar.dart';
import '../../../data/models/product_model.dart';
import '../../base/controllers/base_controller.dart';
class CartController extends GetxController {
// to hold the products in cart
List<ProductModel> products = [];
@override
void onInit() {
getCartProducts();
super.onInit();
}
/// when the user press on purchase now button
onPurchaseNowPressed() {
clearCart();
Get.back();
CustomSnackBar.showCustomSnackBar(
title: 'Purchased',
message: 'Order placed with success'
);
}
/// get the cart products from the product list
getCartProducts() {
products = DummyHelper.products.where((p) => p.quantity > 0).toList();
update();
}
/// clear products in cart and reset cart items count
clearCart() {
DummyHelper.products.map((p) => p.quantity = 0).toList();
Get.find<BaseController>().getCartItemsCount();
}
} | 0 |
mirrored_repositories/flutter_grocery_app/lib/app/modules/cart | mirrored_repositories/flutter_grocery_app/lib/app/modules/cart/bindings/cart_binding.dart | import 'package:get/get.dart';
import '../controllers/cart_controller.dart';
class CartBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<CartController>(
() => CartController(),
);
}
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.