feat(ui_kit): update example by removing adaptative theme
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
part 'app_mode_state.dart';
|
||||
|
||||
class AppModeCubit extends Cubit<AppModeState> {
|
||||
AppModeCubit({
|
||||
required int theme,
|
||||
required Brightness brightness,
|
||||
}) : super(
|
||||
AppModeState(
|
||||
theme: theme,
|
||||
brightness: brightness,
|
||||
),
|
||||
);
|
||||
|
||||
void changeTheme(int theme) {
|
||||
emit(state.copyWith(theme: theme));
|
||||
}
|
||||
|
||||
void changeBrightness(Brightness brightness) {
|
||||
emit(state.copyWith(brightness: brightness));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// ignore_for_file: avoid_equals_and_hash_code_on_mutable_classes
|
||||
|
||||
part of 'app_mode_cubit.dart';
|
||||
|
||||
class AppModeState {
|
||||
const AppModeState({
|
||||
required this.theme,
|
||||
required this.brightness,
|
||||
});
|
||||
final int theme;
|
||||
final Brightness brightness;
|
||||
|
||||
AppModeState copyWith({
|
||||
int? theme,
|
||||
Brightness? brightness,
|
||||
}) =>
|
||||
AppModeState(
|
||||
theme: theme ?? this.theme,
|
||||
brightness: brightness ?? this.brightness,
|
||||
);
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AppModeState &&
|
||||
runtimeType == other.runtimeType &&
|
||||
theme == other.theme &&
|
||||
brightness == other.brightness;
|
||||
|
||||
@override
|
||||
int get hashCode => theme.hashCode ^ brightness.hashCode;
|
||||
}
|
||||
Reference in New Issue
Block a user