Skip to content

Commit

Permalink
Shimmer effect added
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-Thakur-369 committed Nov 18, 2023
1 parent 7eccdcf commit e441ae2
Show file tree
Hide file tree
Showing 7 changed files with 1,502 additions and 1,102 deletions.
18 changes: 9 additions & 9 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import 'package:todo/screens/home_screen.dart';
import 'package:todo/screens/signin_screen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:todo/utilities/notification_service.dart';
import 'package:todo/utilities/task_notification.dart';
import 'firebase_options.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
NotificationService().initNotification();
initializeTimeZones();
await TaskNotification.init();
await NotificationService().initNotification();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
Expand Down Expand Up @@ -158,15 +159,14 @@ class splash_screenState extends State<splash_screen> {
}

Future<void> _init() async {
bool notificationPermission = await requestNotificationPermission();
bool exactAlarmPermission = await requestExactAlarmsPermission();
bool notificationPermission = await requestNotificationPermission();
bool exactAlarmPermission = await requestExactAlarmsPermission();

print('Notification Permission: $notificationPermission');
print('Exact Alarm Permission: $exactAlarmPermission');

stateChage();
}
print('Notification Permission: $notificationPermission');
print('Exact Alarm Permission: $exactAlarmPermission');

stateChage();
}

@override
void initState() {
Expand All @@ -181,7 +181,7 @@ class splash_screenState extends State<splash_screen> {
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
child: Column(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center, // Ensure vertical centering
crossAxisAlignment: CrossAxisAlignment.center,
Expand Down
41 changes: 23 additions & 18 deletions lib/providers/dateTime_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,33 @@ class DatesProvider extends ChangeNotifier {
[31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] // Leap year
];

List<List<Map<String, dynamic>>> dates = [];
List<List<Map<String, dynamic>>> dates = [];

for (int year = currentYear; year <= 2024; year++) {
List<Map<String, dynamic>> yearData = [];
for (int i = currentMonth - 1; i < months.length; i++) {
int dateInMonth = (i == 1 && isLeapYear(year)) ? date[1][i] : date[0][i];
List<Map<String, dynamic>> monthData = [];
int startDay = (year == currentYear && i == currentMonth - 1) ? currentDay : 1;
for (int j = startDay; j <= dateInMonth; j++) {
monthData.add({
'month': months[i],
'date': j,
'year': year,
});
}
yearData.addAll(monthData);
for (int year = currentYear; year <= 2024; year++) {
List<Map<String, dynamic>> yearData = [];
int startMonth = (year == currentYear) ? currentMonth - 1 : 0;

for (int i = startMonth; i < months.length; i++) {
int dateInMonth = (i == 1 && isLeapYear(year)) ? date[1][i] : date[0][i];
List<Map<String, dynamic>> monthData = [];
int startDay = (year == currentYear && i == currentMonth - 1) ? currentDay : 1;

for (int j = startDay; j <= dateInMonth; j++) {
monthData.add({
'month': months[i % 12],
'date': j,
'year': year,
});
}
dates.add(yearData);
yearData.addAll(monthData);
}

return dates;
dates.add(yearData);
}

return dates;
}


bool isLeapYear(int year) {
if (year % 4 != 0) {
return false;
Expand Down Expand Up @@ -129,6 +133,7 @@ class DatesProvider extends ChangeNotifier {
}
}
}

return resultList;
}
}
Loading

0 comments on commit e441ae2

Please sign in to comment.