mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
optimization: desktop UI (#747)
This commit is contained in:
@@ -1,7 +1,27 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
final class AppProvider {
|
||||
const AppProvider._();
|
||||
part 'app.g.dart';
|
||||
part 'app.freezed.dart';
|
||||
|
||||
static BuildContext? ctx;
|
||||
@freezed
|
||||
class AppState with _$AppState {
|
||||
const factory AppState({
|
||||
@Default(false) bool desktopMode,
|
||||
}) = _AppState;
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class AppProvider extends _$AppProvider {
|
||||
static BuildContext? ctx;
|
||||
|
||||
@override
|
||||
AppState build() {
|
||||
return const AppState();
|
||||
}
|
||||
|
||||
void setDesktop(bool desktopMode) {
|
||||
state = state.copyWith(desktopMode: desktopMode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user