This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:freezed_annotation/freezed_annotation.dart'; | |
import 'package:todo_list_riverpod/domain/todo_model.dart'; | |
part 'todo_state.freezed.dart'; | |
@freezed | |
class TodoState with _$TodoState { | |
factory TodoState({ | |
required List<TodoModel> todoList, | |
required TodoModel todo, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies: | |
flutter: | |
sdk: flutter | |
freezed_annotation: ^2.0.3 | |
flutter_riverpod: ^1.0.4 | |
uuid: ^3.0.6 | |
sizer: ^2.0.15 | |
dev_dependencies: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:freezed_annotation/freezed_annotation.dart'; | |
part 'todo_model.freezed.dart'; | |
@freezed | |
class TodoModel with _$TodoModel { | |
const factory TodoModel({ | |
required String id, | |
required String title, | |
required bool isTodoCompleted, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listener: (context, state) { | |
timerController!.duration = state.durationOfTimer; | |
if (state.isTimerReset) { | |
timerController!.reset(); | |
NotificationApi.notifications.cancelAll(); | |
} | |
if (state.isTimerStopped) { | |
timerController!.stop(); | |
NotificationApi.notifications.cancelAll(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppWidget extends StatelessWidget { | |
const AppWidget({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return BlocBuilder<LocalizationCubit, LocalizationState>( | |
builder: (context, state) { | |
return MaterialApp( | |
navigatorKey: navigatorKey, | |
locale: state.appLanguage, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; | |
import 'package:flutter_native_timezone/flutter_native_timezone.dart'; | |
import 'package:rxdart/rxdart.dart'; | |
import 'package:timezone/timezone.dart' as tz; | |
import 'package:timezone/data/latest.dart' as time_zone; | |
class NotificationApi { | |
static const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('timer.png'); | |
static final notifications = FlutterLocalNotificationsPlugin(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:piva/infrastructure/localization/localized_values.dart'; | |
import 'package:format/format.dart'; | |
class PivaLocalizations { | |
PivaLocalizations(this.locale); | |
final Locale locale; | |
static PivaLocalizations of(BuildContext context) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// first, set the language, then set the key and value. | |
const localizedValues = { | |
'en': { | |
"timeIsUpTitle": "Time is Up!", | |
"timeIsUpBody": "Wooosh, it's time to give a break!", | |
"reset": "Reset", | |
"stop": "Stop", | |
"start": "Start", | |
"hours": "Hours", | |
"minutes": "Minutes", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:piva/infrastructure/localization/piva_localization.dart'; | |
class PivaLocalizationsDelegate extends LocalizationsDelegate<PivaLocalizations> { | |
const PivaLocalizationsDelegate(); | |
@override | |
bool isSupported(Locale locale) => true; |