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 | |
flutter_localizations: | |
sdk: flutter | |
flutter_bloc: ^8.0.1 | |
freezed_annotation: ^1.1.0 | |
flutter_countdown_timer: ^4.1.0 | |
simple_timer: ^2.0.0 | |
numberpicker: ^2.1.1 |
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
part of 'localization_cubit.dart'; | |
@freezed | |
class LocalizationState with _$LocalizationState { | |
const factory LocalizationState.initial({ | |
@Default(Locale("en")) Locale appLanguage, | |
}) = _Initial; | |
} |
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:bloc/bloc.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
part 'localization_state.dart'; | |
part 'localization_cubit.freezed.dart'; | |
class LocalizationCubit extends Cubit<LocalizationState> { | |
LocalizationCubit() : super(const LocalizationState.initial()); |
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
part of 'timer_cubit.dart'; | |
@freezed | |
class TimerState with _$TimerState { | |
const TimerState._(); | |
const factory TimerState.initial({ | |
@Default(true) bool isTimerStopped, | |
@Default(true) bool isTimerReset, | |
@Default(false) bool isTimersDurationUp, |
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:bloc/bloc.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
part 'timer_state.dart'; | |
part 'timer_cubit.freezed.dart'; | |
class TimerCubit extends Cubit<TimerState> { | |
TimerCubit() : super(const TimerState.initial()); | |
void updateSecondOfNumberPicker(int seconds) { |
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; |
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/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
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(); |