Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/core/constant/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ class AppColors {
static Color orange = const Color(0xffFEA64C) ;
static Color white = const Color(0xFFFFFFFF) ;
static Color black = const Color(0xFF000000) ;
static Color shop = const Color(0xFFFEA64C).withOpacity(0.3) ;
static Color sport = const Color(0xFFFE1E9A).withOpacity(0.3) ;
static Color location = const Color(0xFF254DDE).withOpacity(0.3) ;
static Color health= const Color(0xFFFE1E9A).withOpacity(0.3) ;
static Color other = const Color(0xFF181743).withOpacity(0.3) ;
static Color shop = const Color(0xFFFEA64C).withValues(alpha: 0.3);
static Color sport = const Color(0xFFFE1E9A).withValues(alpha: 0.3);
static Color location = const Color(0xFF254DDE).withValues(alpha: 0.3);
static Color health = const Color(0xFFFE1E9A).withValues(alpha: 0.3);
static Color other = const Color(0xFF181743).withValues(alpha: 0.3);

}
28 changes: 16 additions & 12 deletions lib/core/database/todo_data_base.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:sqflite/sqflite.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:path/path.dart';
import 'package:todo/features/todo/data/models/todo_model.dart';

Expand All @@ -13,6 +13,12 @@ const String time = "time";
class TodoDataBase {
static Database? _db;

TodoDataBase() {
// Initialize the database factory for FFI
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
}

Future<Database?> get db async {
if (_db == null) {
_db = await initDataBase();
Expand All @@ -31,15 +37,15 @@ class TodoDataBase {

_onCraete(Database database, int version) {
database.execute('''
CREATE TABLE todo (
id INTEGER PRIMARY KEY AUTOINCREMENT,
iconId INTEGER,
isDone INTEGER,
title TEXT,
description TEXT,
time TEXT
)
''');
CREATE TABLE todo (
id INTEGER PRIMARY KEY AUTOINCREMENT,
iconId INTEGER,
isDone INTEGER,
title TEXT,
description TEXT,
time TEXT
)
''');
}

Future<int> insertTodo(TodoModel todoModel) async {
Expand All @@ -62,8 +68,6 @@ class TodoDataBase {

Future<List> getNotDoneTodo() async {
Database? database = await db;
// List status = await database!
// .query(todo, columns: [id, iconId, isDone, title, description, time], where: '$isDone = ?', whereArgs: [0]);
List status = await database!.rawQuery('SELECT * FROM $todo WHERE $isDone = 0 ORDER BY $id DESC');
return status;
}
Expand Down
25 changes: 19 additions & 6 deletions lib/core/my_bloc_observer.dart
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class MyBlocObserver extends BlocObserver {
@override
void onCreate(BlocBase bloc) {
super.onCreate(bloc);
print('onCreate -- ${bloc.runtimeType}');
if (kDebugMode) {
print('onCreate -- ${bloc.runtimeType}');
}
}

@override
void onEvent(Bloc bloc, Object? event) {
super.onEvent(bloc, event);
print('onEvent -- ${bloc.runtimeType}, $event');
if (kDebugMode) {
print('onEvent -- ${bloc.runtimeType}, $event');
}
}

@override
void onChange(BlocBase bloc, Change change) {
super.onChange(bloc, change);
print('onChange -- ${bloc.runtimeType}, $change');
if (kDebugMode) {
print('onChange -- ${bloc.runtimeType}, $change');
}
}

@override
void onTransition(Bloc bloc, Transition transition) {
super.onTransition(bloc, transition);
print('onTransition -- ${bloc.runtimeType}, $transition');
if (kDebugMode) {
print('onTransition -- ${bloc.runtimeType}, $transition');
}
}

@override
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
print('onError -- ${bloc.runtimeType}, $error');
if (kDebugMode) {
print('onError -- ${bloc.runtimeType}, $error');
}
super.onError(bloc, error, stackTrace);
}

@override
void onClose(BlocBase bloc) {
super.onClose(bloc);
print('onClose -- ${bloc.runtimeType}');
if (kDebugMode) {
print('onClose -- ${bloc.runtimeType}');
}
}
}
2 changes: 1 addition & 1 deletion lib/features/todo/presentation/pages/done_todo_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DoneTodoPage extends StatelessWidget {
return Expanded(
child: Center(
child: CircularProgressIndicator(
color: AppColors.bgGrandentTop.withOpacity(0.3),
color: AppColors.bgGrandentTop.withValues(alpha:0.3),
),
));
} else if (state is ErrorTodoState) {
Expand Down
11 changes: 8 additions & 3 deletions lib/features/todo/presentation/pages/splash_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ class SplashScreen extends StatefulWidget {
}

class _SplashScreenState extends State<SplashScreen> {
Future<void> goToHome () async{
await Future.delayed(const Duration(seconds: 3) , ()=> Navigator.of(context).pushNamedAndRemoveUntil(AppRoute.todo, (route) => false));
Future<void> goToHome() async {
await Future.delayed(const Duration(seconds: 3));
if (mounted) {
Navigator.of(context).pushNamedAndRemoveUntil(AppRoute.todo, (route) => false);
}
}

@override
void initState() {
goToHome();
super.initState();
goToHome();
}

@override
Widget build(BuildContext context) {
return Container(
Expand Down
2 changes: 1 addition & 1 deletion lib/features/todo/presentation/pages/todo_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _TodoPageState extends State<TodoPage> {
Expanded(
child: Center(
child: CircularProgressIndicator(
color: AppColors.bgGrandentTop.withOpacity(0.3),
color: AppColors.bgGrandentTop.withValues(alpha:0.3),
),
));
//!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class DoneTodoPostWidget extends StatelessWidget {
width: double.maxFinite,
height: 52,
decoration: BoxDecoration(
color: AppColors.white.withOpacity(0.9),
color: AppColors.white.withValues(alpha:0.9),
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(color: AppColors.black.withOpacity(0.06), blurRadius: 6, offset: const Offset(0, 1))
BoxShadow(color: AppColors.black.withValues(alpha:0.6), blurRadius: 6, offset: const Offset(0, 1))
]),
child: Row(
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DialogMoreWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Dialog(
backgroundColor: const Color(0xFF000000).withOpacity(0),
backgroundColor: const Color(0xFF000000).withValues(alpha:0),
insetPadding: const EdgeInsets.all(0),
child: SizedBox(
child: Container(
Expand Down Expand Up @@ -41,7 +41,7 @@ class PartTopOfDialog extends StatelessWidget {
height: 123,
width: double.maxFinite,
decoration: BoxDecoration(
color: AppColors.bgGrandentTop.withOpacity(0.02),
color: AppColors.bgGrandentTop.withValues(alpha:0.02),
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(6))),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final Widget widget ;
width: double.maxFinite,
decoration: BoxDecoration(
gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [
const Color(0xffCAEBFE).withOpacity(0),
const Color(0xffCAEBFE).withValues(alpha:0),
const Color(0xffffffff),
])),
child: widget ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BgDrawer extends StatelessWidget {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [AppColors.bgGrandentTop.withOpacity(0.03), AppColors.bgGrandentDown.withOpacity(0.03)]),
colors: [AppColors.bgGrandentTop.withValues(alpha:0.03), AppColors.bgGrandentDown.withValues(alpha:0.03)]),
image: DecorationImage(image: AssetImage(AppImages.bgDrawer), fit: BoxFit.cover)),
);
}
Expand All @@ -39,7 +39,7 @@ class BgDrawer extends StatelessWidget {
decoration: BoxDecoration(
gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [
const Color(0xffffffff),
AppColors.filterColor.withOpacity(0.0),
AppColors.filterColor.withValues(alpha:0.0),
])),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BgWidget extends StatelessWidget {
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [AppColors.bgGrandentTop.withOpacity(0.03),AppColors.bgGrandentDown.withOpacity(0.03)]),
colors: [AppColors.bgGrandentTop.withValues(alpha:0.03),AppColors.bgGrandentDown.withValues(alpha:0)]),
image: DecorationImage(image: AssetImage(AppImages.bgImage), fit: BoxFit.cover)),
);
}
Expand All @@ -42,7 +42,7 @@ class BgWidget extends StatelessWidget {
decoration: BoxDecoration(
gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [
AppColors.white,
AppColors.filterColor.withOpacity(0.0),
AppColors.filterColor.withValues(alpha:0),
])),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ButtonAddAndDone extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
boxShadow: [
BoxShadow(color: AppColors.iconAddBgGrandentTop.withOpacity(0.3), blurRadius: 6, offset: const Offset(0, 3))
BoxShadow(color: AppColors.iconAddBgGrandentTop.withValues(alpha:0.3), blurRadius: 6, offset: const Offset(0, 3))
],
gradient: LinearGradient(
begin: Alignment.topRight,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ class DescriptionFormField extends StatelessWidget {
controller: textEditingController,
style: TextStyle(fontSize: 14, color: AppColors.bgGrandentTop),
cursorHeight: 20,
cursorColor: AppColors.bgGrandentTop.withOpacity(0.4),
cursorColor: AppColors.bgGrandentTop.withValues(alpha:0.4),
decoration: InputDecoration(
filled: true,
fillColor: AppColors.white.withOpacity(0.8),
fillColor: AppColors.white.withValues(alpha:0.8),
contentPadding: const EdgeInsets.all(7),
isDense: true,
hintText: 'Add description for you to do',
hintStyle: const TextStyle(fontSize: 12),
border: const OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(6),
borderSide: BorderSide(color: AppColors.bgGrandentTop.withOpacity(0.2))),
borderSide: BorderSide(color: AppColors.bgGrandentTop.withValues(alpha:0.2))),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(6),
borderSide: BorderSide(color: AppColors.bgGrandentTop.withOpacity(0.2)))),
borderSide: BorderSide(color: AppColors.bgGrandentTop.withValues(alpha:0.2)))),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DrawerTimeAndData extends StatelessWidget {
// ignore: avoid_unnecessary_containers
childWidget: Container(
child: InkWell(
splashColor: AppColors.white.withOpacity(0),
splashColor: AppColors.white.withValues(alpha:0),
onTap: onTapIcon,
child: Column(
children: [
Expand All @@ -25,7 +25,7 @@ class DrawerTimeAndData extends StatelessWidget {
),
Divider(
thickness: 1,
color: AppColors.bgGrandentTop.withOpacity(0.12),
color: AppColors.bgGrandentTop.withValues(alpha:0.12),
)
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class IconWidget extends StatelessWidget {
height: 32,
width: 32,
child: CircleAvatar(
backgroundColor: StaticData.colorsStatusImage[index].colorStatus.withOpacity(0.12),
backgroundColor: StaticData.colorsStatusImage[index].colorStatus.withValues(alpha: 0.12),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ class NameFormField extends StatelessWidget {
controller: textEditingController,
style: TextStyle(fontSize: 14, color: AppColors.bgGrandentTop),
cursorHeight: 20,
cursorColor: AppColors.bgGrandentTop.withOpacity(0.4),
cursorColor: AppColors.bgGrandentTop.withValues(alpha: 0.4),
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(top: 3, bottom: 7),
isDense: true,
hintText: 'Add name for you to do',
hintStyle: const TextStyle(fontSize: 12),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: AppColors.bgGrandentDown.withOpacity(0.3), width: 1)),
borderSide: BorderSide(color: AppColors.bgGrandentDown.withValues(alpha: 0.3), width: 1)),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: AppColors.bgGrandentDown.withOpacity(0.5), width: 1.5))),
borderSide: BorderSide(color: AppColors.bgGrandentDown.withValues(alpha: 0.5), width: 1.5))),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IconBottomGradent extends StatelessWidget {
width: 46,
decoration: BoxDecoration(
shape: BoxShape.circle,
boxShadow: [BoxShadow(color: topGrandient.withOpacity(0.3), blurRadius: 6, offset: const Offset(0, 3))],
boxShadow: [BoxShadow(color: topGrandient.withValues(alpha: 0.3), blurRadius: 6, offset: const Offset(0, 3))],
gradient: LinearGradient(
begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [topGrandient, bottomGrandient])),
child: Center(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MainBottomBar extends StatelessWidget {
width: 56,
decoration: BoxDecoration(
color: AppColors.white,
boxShadow: [BoxShadow(color: AppColors.other.withOpacity(0.2), blurRadius: 6, offset: const Offset(0, 4))],
boxShadow: [BoxShadow(color: AppColors.other.withValues(alpha: 0.2), blurRadius: 6, offset: const Offset(0, 4))],
shape: BoxShape.circle,
),
child: Center(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class TodoPostWidget extends StatelessWidget {
width: double.maxFinite,
height: 52,
decoration: BoxDecoration(
color: AppColors.white.withOpacity(0.9),
color: AppColors.white.withValues(alpha: 0.9),
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(color: AppColors.black.withOpacity(0.06), blurRadius: 6, offset: const Offset(0, 1))
BoxShadow(color: AppColors.black.withValues(alpha: 0.06), blurRadius: 6, offset: const Offset(0, 1))
]),
child: Row(
children: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class TodoPostsCheckout extends StatelessWidget {
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.circular(6),
border: Border.all(color: AppColors.bgGrandentTop.withOpacity(0.2)),
border: Border.all(color: AppColors.bgGrandentTop.withValues(alpha: 0.2)),
boxShadow: [
BoxShadow(
color: AppColors.iconDoneBgGrandentTop.withOpacity(0.1), blurRadius: 4, offset: const Offset(0, 2)),
color: AppColors.iconDoneBgGrandentTop.withValues(alpha: 0.1), blurRadius: 4, offset: const Offset(0, 2)),
]),
child: _checkIcon(),
),
Expand All @@ -41,7 +41,7 @@ class TodoPostsCheckout extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
gradient: LinearGradient(colors: [
AppColors.white.withOpacity(0),
AppColors.white.withValues(alpha: 0),
AppColors.white,
])),
child: widget,
Expand Down
6 changes: 3 additions & 3 deletions lib/theme/my_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ ThemeData myTheme() {
titleLarge: TextStyle(fontSize: 20, color: AppColors.bgGrandentTop, fontFamily: "baloo"),
titleSmall: TextStyle(fontSize: 16, color: AppColors.bgGrandentTop, fontWeight: FontWeight.bold),
labelLarge:
TextStyle(fontSize: 12, color: AppColors.bgGrandentTop.withOpacity(0.2), fontWeight: FontWeight.bold),
TextStyle(fontSize: 12, color: AppColors.bgGrandentTop.withValues(alpha: 0.2), fontWeight: FontWeight.bold),
labelMedium:
TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: AppColors.bgGrandentTop.withOpacity(0.8)),
TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: AppColors.bgGrandentTop.withValues(alpha: 0.8)),
// ignore: prefer_const_constructors
bodySmall: TextStyle(fontSize: 12, color: const Color(0xff95989A)),
bodyMedium: TextStyle(
color: AppColors.bgGrandentTop, fontFamily: "lato", fontSize: 14, overflow: TextOverflow.ellipsis),
labelSmall: TextStyle(fontSize: 10, color: AppColors.bgGrandentTop.withOpacity(0.6))));
labelSmall: TextStyle(fontSize: 10, color: AppColors.bgGrandentTop.withValues(alpha: 0.6))));
}
Loading