2025-02-03 23:32:00 +08:00
|
|
|
import 'package:flutter/widgets.dart';
|
2024-12-09 01:40:39 +08:00
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
|
|
|
|
|
|
part 'generated/widget.freezed.dart';
|
|
|
|
|
|
|
|
|
|
@freezed
|
2025-07-31 17:09:18 +08:00
|
|
|
abstract class ActivateState with _$ActivateState {
|
2025-10-14 15:13:52 +08:00
|
|
|
const factory ActivateState({required bool active}) = _ActivateState;
|
2024-12-09 01:40:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@freezed
|
2025-07-31 17:09:18 +08:00
|
|
|
abstract class CommonMessage with _$CommonMessage {
|
2024-12-09 01:40:39 +08:00
|
|
|
const factory CommonMessage({
|
|
|
|
|
required String id,
|
|
|
|
|
required String text,
|
|
|
|
|
@Default(Duration(seconds: 3)) Duration duration,
|
2025-10-14 15:13:52 +08:00
|
|
|
MessageActionState? actionState,
|
2024-12-09 01:40:39 +08:00
|
|
|
}) = _CommonMessage;
|
|
|
|
|
}
|
2025-02-03 23:32:00 +08:00
|
|
|
|
2025-10-14 15:13:52 +08:00
|
|
|
@freezed
|
|
|
|
|
abstract class MessageActionState with _$MessageActionState {
|
|
|
|
|
const factory MessageActionState({
|
|
|
|
|
required String actionText,
|
|
|
|
|
required VoidCallback action,
|
|
|
|
|
}) = _MessageActionState;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-03 23:32:00 +08:00
|
|
|
@freezed
|
2025-07-31 17:09:18 +08:00
|
|
|
abstract class AppBarState with _$AppBarState {
|
2025-03-12 17:15:31 +08:00
|
|
|
const factory AppBarState({
|
2025-02-03 23:32:00 +08:00
|
|
|
@Default([]) List<Widget> actions,
|
2025-03-12 17:15:31 +08:00
|
|
|
AppBarSearchState? searchState,
|
|
|
|
|
AppBarEditState? editState,
|
|
|
|
|
}) = _AppBarState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@freezed
|
2025-07-31 17:09:18 +08:00
|
|
|
abstract class AppBarSearchState with _$AppBarSearchState {
|
2025-03-12 17:15:31 +08:00
|
|
|
const factory AppBarSearchState({
|
|
|
|
|
required Function(String) onSearch,
|
2025-10-14 15:13:52 +08:00
|
|
|
@Default(true) bool autoAddSearch,
|
2025-06-07 01:48:34 +08:00
|
|
|
@Default(null) String? query,
|
2025-03-12 17:15:31 +08:00
|
|
|
}) = _AppBarSearchState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@freezed
|
2025-07-31 17:09:18 +08:00
|
|
|
abstract class AppBarEditState with _$AppBarEditState {
|
2025-03-12 17:15:31 +08:00
|
|
|
const factory AppBarEditState({
|
2025-06-07 01:48:34 +08:00
|
|
|
@Default(0) int editCount,
|
2025-03-12 17:15:31 +08:00
|
|
|
required Function() onExit,
|
|
|
|
|
}) = _AppBarEditState;
|
2025-02-03 23:32:00 +08:00
|
|
|
}
|