diff --git a/lib/bloc/gebura/gebura_bloc.dart b/lib/bloc/gebura/gebura_bloc.dart index 73629e1..c048774 100644 --- a/lib/bloc/gebura/gebura_bloc.dart +++ b/lib/bloc/gebura/gebura_bloc.dart @@ -192,7 +192,6 @@ class GeburaBloc extends Bloc { final appInsts = await _repo.loadLocalAppInsts(); final appInstsMap = Map.fromEntries(appInsts.map((e) => MapEntry(e.uuid, e))); - appInstsMap.addAll(state.libraryAppInsts); emit(GeburaLoadAppInstsState( state.copyWith( libraryAppInsts: appInstsMap, @@ -210,7 +209,6 @@ class GeburaBloc extends Bloc { final launchers = await _repo.loadLocalAppInstLaunchers(); final launchersMap = Map.fromEntries(launchers.map((e) => MapEntry(e.uuid, e))); - launchersMap.addAll(state.libraryAppInstLaunchers); emit(GeburaLoadAppInstLaunchersState( state.copyWith( libraryAppInstLaunchers: launchersMap, @@ -960,18 +958,70 @@ class GeburaBloc extends Bloc { // return resp.getData(); // } // + Future updateLocalApp(LocalApp app) async { + try { + await _repo.updateLocalApp(app); + add(GeburaRefreshLibraryListEvent()); + return null; + } catch (e) { + return e.toString(); + } + } + + Future addLocalAppInst(LocalAppInst appInst) async { + try { + await _repo.addLocalAppInst(appInst); + add(GeburaLoadAppInstsEvent()); + return null; + } catch (e) { + return e.toString(); + } + } + + Future updateLocalAppInst(LocalAppInst appInst) async { + try { + await _repo.updateLocalAppInst(appInst); + add(GeburaLoadAppInstsEvent()); + return null; + } catch (e) { + return e.toString(); + } + } + + Future addLocalAppInstLauncher( + LocalAppInstLauncher appInstLauncher) async { + try { + await _repo.addLocalAppInstLauncher(appInstLauncher); + add(GeburaLoadAppInstLaunchersEvent()); + return null; + } catch (e) { + return e.toString(); + } + } + + Future updateLocalAppInstLauncher( + LocalAppInstLauncher appInstLauncher) async { + try { + await _repo.updateLocalAppInstLauncher(appInstLauncher); + add(GeburaLoadAppInstLaunchersEvent()); + return null; + } catch (e) { + return e.toString(); + } + } + Future showSteamAppDetails(String steamAppID) async { await launchUrlString('steam://nav/games/details/$steamAppID'); } - Future saveLocalCommonAppLibraryFolder(CommonAppScan setting) async { + Future saveLocalCommonAppLibraryFolder(CommonAppScan setting) async { try { await _repo.addLocalCommonLibraryFolder(_toDaoCommonAppScan(setting)); add(GeburaScanLocalLibraryEvent(refreshCommon: [setting.uuid])); } catch (e) { - return false; + return e.toString(); } - return true; + return null; } Future getLocalCommonAppLibraryFolder(String uuid) async { diff --git a/lib/repo/gebura/gebura_repo.dart b/lib/repo/gebura/gebura_repo.dart index da98485..5324519 100644 --- a/lib/repo/gebura/gebura_repo.dart +++ b/lib/repo/gebura/gebura_repo.dart @@ -71,6 +71,10 @@ class GeburaRepo { return _dao.addLocalAppInst(inst); } + Future updateLocalAppInst(LocalAppInst inst) async { + await _dao.updateLocalAppInst(inst); + } + Future> loadLocalAppInsts({String? appUUID}) async { return _dao.loadLocalAppInsts(appUUID: appUUID); } diff --git a/lib/route.dart b/lib/route.dart index b13eec3..6c43583 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:dao/dao.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -429,8 +430,7 @@ class GeburaLibraryRoute extends GoRouteData { } enum GeburaLibrarySettingsActions { - commonAppScanResult, - steamAppScanResult, + appScanResult, } class GeburaLibrarySettingsRoute extends GoRouteData { @@ -442,14 +442,9 @@ class GeburaLibrarySettingsRoute extends GoRouteData { @override Page buildPage(BuildContext context, GoRouterState state) { final actions = { - GeburaLibrarySettingsActions.commonAppScanResult: - GeburaAppScanResultPanel( + GeburaLibrarySettingsActions.appScanResult: GeburaAppScanResultPanel( uuid: $extra is String ? $extra! as String : '', ), - // GeburaLibrarySettingsActions.steamAppScanResult: - // GeburaSteamAppScanResultPanel( - // folder: $extra is String ? $extra! as String : '', - // ), }; return NoTransitionPage( child: GeburaRoute.rootWidget( @@ -457,7 +452,7 @@ class GeburaLibrarySettingsRoute extends GoRouteData { leftPart: const GeburaNav( function: GeburaFunctions.librarySettings, ), - middlePart: const GeburaLibrarySettings(), + middlePart: const GeburaLibrarySettingsPage(), rightPart: actions[action] ?? Container(), ), ), @@ -465,28 +460,57 @@ class GeburaLibrarySettingsRoute extends GoRouteData { } } -enum GeburaLibraryDetailActions { assignApp } +enum GeburaLibraryDetailActions { + assignApp, + appEdit, + appInstAdd, + appInstEdit, + appInstLauncherAdd, + appInstLauncherEdit, +} class GeburaLibraryDetailRoute extends GoRouteData { - const GeburaLibraryDetailRoute(this.uuid, {this.action}); + const GeburaLibraryDetailRoute(this.uuid, {this.action, this.$extra}); final GeburaLibraryDetailActions? action; final String uuid; + final dynamic $extra; @override Page buildPage(BuildContext context, GoRouterState state) { final actions = { GeburaLibraryDetailActions.assignApp: const GeburaAssignAppPanel(), + GeburaLibraryDetailActions.appEdit: GeburaLibraryDetailAppPanel( + uuid: uuid, + ), + GeburaLibraryDetailActions.appInstAdd: GeburaLibraryDetailAppInstAddPanel( + uuid: uuid, + ), + GeburaLibraryDetailActions.appInstEdit: + GeburaLibraryDetailAppInstEditPanel( + initialValue: $extra is LocalAppInst ? $extra! as LocalAppInst : null, + ), + GeburaLibraryDetailActions.appInstLauncherAdd: + GeburaLibraryDetailAppInstLauncherAddPanel( + uuid: uuid, + inst: $extra is LocalAppInst ? $extra! as LocalAppInst : null, + ), + GeburaLibraryDetailActions.appInstLauncherEdit: + GeburaLibraryDetailAppInstLauncherEditPanel( + launcher: $extra is LocalAppInstLauncher + ? $extra! as LocalAppInstLauncher + : null, + ), }; return NoTransitionPage( child: GeburaRoute.rootWidget( child: ModuleFramePage( leftPart: GeburaNav( function: GeburaFunctions.library, - selectedItem: uuid ?? '', + selectedItem: uuid, ), - middlePart: GeburaLibraryDetailPage(uuid: uuid ?? ''), - rightPart: actions[action], + middlePart: GeburaLibraryDetailPage(uuid: uuid), + rightPart: actions[action] ?? Container(), ), ), ); diff --git a/lib/route.g.dart b/lib/route.g.dart index 5d4d7c9..449bbae 100644 --- a/lib/route.g.dart +++ b/lib/route.g.dart @@ -341,8 +341,7 @@ extension $GeburaLibrarySettingsRouteExtension on GeburaLibrarySettingsRoute { } const _$GeburaLibrarySettingsActionsEnumMap = { - GeburaLibrarySettingsActions.commonAppScanResult: 'common-app-scan-result', - GeburaLibrarySettingsActions.steamAppScanResult: 'steam-app-scan-result', + GeburaLibrarySettingsActions.appScanResult: 'app-scan-result', }; extension $GeburaLibraryDetailRouteExtension on GeburaLibraryDetailRoute { @@ -351,6 +350,7 @@ extension $GeburaLibraryDetailRouteExtension on GeburaLibraryDetailRoute { state.pathParameters['uuid']!, action: _$convertMapValue('action', state.uri.queryParameters, _$GeburaLibraryDetailActionsEnumMap._$fromName), + $extra: state.extra as dynamic, ); String get location => GoRouteData.$location( @@ -361,18 +361,25 @@ extension $GeburaLibraryDetailRouteExtension on GeburaLibraryDetailRoute { }, ); - void go(BuildContext context) => context.go(location); + void go(BuildContext context) => context.go(location, extra: $extra); - Future push(BuildContext context) => context.push(location); + Future push(BuildContext context) => + context.push(location, extra: $extra); void pushReplacement(BuildContext context) => - context.pushReplacement(location); + context.pushReplacement(location, extra: $extra); - void replace(BuildContext context) => context.replace(location); + void replace(BuildContext context) => + context.replace(location, extra: $extra); } const _$GeburaLibraryDetailActionsEnumMap = { GeburaLibraryDetailActions.assignApp: 'assign-app', + GeburaLibraryDetailActions.appEdit: 'app-edit', + GeburaLibraryDetailActions.appInstAdd: 'app-inst-add', + GeburaLibraryDetailActions.appInstEdit: 'app-inst-edit', + GeburaLibraryDetailActions.appInstLauncherAdd: 'app-inst-launcher-add', + GeburaLibraryDetailActions.appInstLauncherEdit: 'app-inst-launcher-edit', }; extension $ChesedRootRouteExtension on ChesedRootRoute { diff --git a/lib/view/layout/bootstrap_container.dart b/lib/view/layout/bootstrap_container.dart index d6fead4..69eff1f 100644 --- a/lib/view/layout/bootstrap_container.dart +++ b/lib/view/layout/bootstrap_container.dart @@ -8,11 +8,13 @@ class BootstrapContainer extends StatelessWidget { required this.children, this.alignment = Alignment.center, this.fill = BootstrapSteps.undefined, + this.useWrap = false, }); final List children; final AlignmentGeometry alignment; final BootstrapSteps fill; + final bool useWrap; @override Widget build(BuildContext context) { @@ -74,10 +76,14 @@ class BootstrapContainer extends StatelessWidget { maxWidth: maxWidth, ), width: maxWidth, - child: Row( - mainAxisSize: MainAxisSize.min, - children: children, - ), + child: useWrap + ? Wrap( + children: children, + ) + : Row( + mainAxisSize: MainAxisSize.min, + children: children, + ), ), ), ); diff --git a/lib/view/pages/gebura/gebura_common.dart b/lib/view/pages/gebura/gebura_common.dart index 828e843..76cb714 100644 --- a/lib/view/pages/gebura/gebura_common.dart +++ b/lib/view/pages/gebura/gebura_common.dart @@ -20,11 +20,11 @@ class GeburaAppCoverImage extends StatelessWidget { Widget build(BuildContext context) { return BlocBuilder( builder: (context, state) { - if (path != null) { + if (path != null && path!.isNotEmpty) { return ExtendedImage.file( io.File(path!), ); - } else if (url != null) { + } else if (url != null && url!.isNotEmpty) { return ExtendedImage.network( url!, height: 200, @@ -58,12 +58,12 @@ class GeburaAppIconImage extends StatelessWidget { final String? path; DecorationImage? _buildImage(BuildContext context) { - if (path != null) { + if (path != null && path!.isNotEmpty) { return DecorationImage( image: ExtendedFileImageProvider(io.File(path!)), fit: BoxFit.scaleDown, ); - } else if (url != null) { + } else if (url != null && url!.isNotEmpty) { return DecorationImage( image: ExtendedNetworkImageProvider(url!), fit: BoxFit.scaleDown, @@ -101,12 +101,12 @@ class GeburaAppBackgroundImage extends StatelessWidget { final String? path; DecorationImage? _buildImage(BuildContext context) { - if (path != null) { + if (path != null && path!.isNotEmpty) { return DecorationImage( image: ExtendedFileImageProvider(io.File(path!)), fit: BoxFit.cover, ); - } else if (url != null) { + } else if (url != null && url!.isNotEmpty) { return DecorationImage( image: ExtendedNetworkImageProvider(url!), fit: BoxFit.cover, diff --git a/lib/view/pages/gebura/gebura_library_detail.dart b/lib/view/pages/gebura/gebura_library_detail.dart index 1d92a8f..ccd5d8c 100644 --- a/lib/view/pages/gebura/gebura_library_detail.dart +++ b/lib/view/pages/gebura/gebura_library_detail.dart @@ -1,7 +1,7 @@ -import 'dart:async'; - import 'package:auto_size_text/auto_size_text.dart'; import 'package:dao/dao.dart'; +import 'package:file_picker/file_picker.dart' as file_picker; +import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -10,19 +10,29 @@ import 'package:smooth_scroll_multiplatform/smooth_scroll_multiplatform.dart'; import 'package:tuihub_protos/librarian/sephirah/v1/gebura.pb.dart'; import 'package:tuihub_protos/librarian/v1/wellknown.pb.dart'; import 'package:universal_io/io.dart'; +import 'package:uuid/uuid.dart'; import '../../../bloc/gebura/gebura_bloc.dart'; import '../../../bloc/main_bloc.dart'; import '../../../common/platform.dart'; import '../../../repo/grpc/l10n.dart'; import '../../../route.dart'; +import '../../components/input_formatters.dart'; +import '../../components/pop_alert.dart'; import '../../components/toast.dart'; +import '../../layout/bootstrap_breakpoints.dart'; import '../../layout/bootstrap_container.dart'; import '../../specialized/backdrop_blur.dart'; +import '../../specialized/right_panel_form.dart'; import '../../universal/universal.dart'; -import 'gebura_app_launcher_setting_dialog.dart'; +import '../frame_page.dart'; import 'gebura_common.dart'; +part 'gebura_library_detail_app_inst_launcher_panel.dart'; +part 'gebura_library_detail_app_inst_panel.dart'; +part 'gebura_library_detail_app_panel.dart'; +part 'gebura_library_detail_launcher_setting_dialog.dart'; + class GeburaLibraryDetailPage extends StatelessWidget { const GeburaLibraryDetailPage({super.key, required this.uuid}); @@ -194,6 +204,8 @@ class GeburaLibraryDetailPage extends StatelessWidget { SpacingHelper.listSpacing(width: 24, children: [ if (PlatformHelper.isWindowsApp()) UniversalElevatedButton.icon( + padding: const EdgeInsets.symmetric( + horizontal: 16, vertical: 8), onPressed: (launcherUUID == null) ? null : () async { @@ -205,8 +217,22 @@ class GeburaLibraryDetailPage extends StatelessWidget { launcherType == LocalAppInstLauncherType.steam ? FontAwesomeIcons.steam : UniversalUI.of(context).icons.play, + size: Theme.of(context) + .textTheme + .titleLarge + ?.fontSize ?? + 22, + ), + label: Text( + '启动', + style: TextStyle( + fontSize: Theme.of(context) + .textTheme + .titleMedium + ?.fontSize ?? + 16, + ), ), - label: const Text('启动'), ), if (PlatformHelper.isWindowsApp()) digestItem( @@ -222,6 +248,9 @@ class GeburaLibraryDetailPage extends StatelessWidget { ), ), _GeburaLibraryDetailInstList(item: item), + const SizedBox( + height: 16, + ), ], ), ); @@ -232,11 +261,21 @@ class GeburaLibraryDetailPage extends StatelessWidget { } } -class _GeburaLibraryDetailInstList extends StatelessWidget { +class _GeburaLibraryDetailInstList extends StatefulWidget { const _GeburaLibraryDetailInstList({required this.item}); final LocalApp item; + @override + State<_GeburaLibraryDetailInstList> createState() => + _GeburaLibraryDetailInstListState(); +} + +class _GeburaLibraryDetailInstListState + extends State<_GeburaLibraryDetailInstList> { + LocalApp get item => widget.item; + bool _onlyShowFavorites = true; + Widget _activeRadio(BuildContext context, LocalAppInstLauncher launcher, bool triggerActivation) { final selected = context @@ -268,17 +307,35 @@ class _GeburaLibraryDetailInstList extends StatelessWidget { return UniversalListTile( leading: _activeRadio(context, launcher, triggerActivation), title: const Text('由Steam管理'), - trailing: launcher.steam != null - ? UniversalElevatedButton.icon( - onPressed: () async { - await context - .read() - .showSteamAppDetails(launcher.steam!.steamAppID); - }, - icon: const Icon(FontAwesomeIcons.steam, size: 16), - label: const Text('查看'), - ) - : null, + trailing: Wrap( + spacing: 8, + children: [ + UniversalIconButton( + icon: Icon(launcher.favorite ?? false + ? UniversalUI.of(context).icons.favorite + : UniversalUI.of(context).icons.favoriteBorder), + onPressed: () async { + final msg = await context + .read() + .updateLocalAppInstLauncher(launcher.copyWith( + favorite: !(launcher.favorite ?? false), + )); + if (msg != null) { + Toast(title: '', message: msg).show(context); + } + }, + ), + UniversalElevatedButton.icon( + onPressed: () async { + await context + .read() + .showSteamAppDetails(launcher.steam!.steamAppID); + }, + icon: const Icon(FontAwesomeIcons.steam, size: 16), + label: const Text('查看'), + ), + ], + ), ); } @@ -316,19 +373,37 @@ class _GeburaLibraryDetailInstList extends StatelessWidget { overflow: TextOverflow.ellipsis, ) : null, - trailing: UniversalElevatedButton.icon( - onPressed: () async { - unawaited(showDialog( - context: context, - builder: (_) => BlocProvider.value( - value: context.read(), - child: GeburaAppLauncherSettingDialog( - launcher, Navigator.of(context)), - ), - )); - }, - icon: Icon(UniversalUI.of(context).icons.settings, size: 16), - label: const Text('设置'), + trailing: Wrap( + spacing: 8, + children: [ + UniversalIconButton( + icon: Icon(launcher.favorite ?? false + ? UniversalUI.of(context).icons.favorite + : UniversalUI.of(context).icons.favoriteBorder), + onPressed: () async { + final msg = await context + .read() + .updateLocalAppInstLauncher(launcher.copyWith( + favorite: !(launcher.favorite ?? false), + )); + if (msg != null) { + Toast(title: '', message: msg).show(context); + } + }, + ), + UniversalElevatedButton.icon( + onPressed: () async { + GeburaLibraryDetailRoute( + widget.item.uuid, + action: GeburaLibraryDetailActions.appInstLauncherEdit, + $extra: launcher, + ).go(context); + ModuleFramePage.of(context)?.openDrawer(); + }, + icon: Icon(UniversalUI.of(context).icons.settings, size: 16), + label: const Text('设置'), + ), + ], ), ); } @@ -336,7 +411,8 @@ class _GeburaLibraryDetailInstList extends StatelessWidget { @override Widget build(BuildContext context) { return BlocBuilder(builder: (context, state) { - final List listTiles = []; + final List favoriteTiles = []; + final List instTiles = []; final appInsts = state.libraryAppInsts.values.where((e) => e.appUUID == item.uuid); @@ -344,26 +420,56 @@ class _GeburaLibraryDetailInstList extends StatelessWidget { final launchers = state.libraryAppInstLaunchers.values .where((e) => e.appInstUUID == inst.uuid) .toList(); - final msg = '${launchers.length} 个启动项'; + final subtitle = inst.path; + + final children = []; + for (final launcher in launchers) { + late Widget child; + switch (launcher.launcherType) { + case LocalAppInstLauncherType.steam: + child = _steamItem(context, launcher, + launcher.steam != null && launchers.length == 1); + case LocalAppInstLauncherType.common: + child = _localItem(context, inst, launcher, false); + } + children.add(child); + if (launcher.favorite ?? false) { + favoriteTiles.add(child); + } + } final listTile = UniversalExpansionTile( initiallyExpanded: true, - title: Text(msg), + title: AutoSizeText(inst.name ?? inst.path), + subtitle: Text(subtitle), + trailing: Wrap( + children: [ + UniversalIconButton( + icon: Icon(UniversalUI.of(context).icons.add), + onPressed: () { + GeburaLibraryDetailRoute( + widget.item.uuid, + action: GeburaLibraryDetailActions.appInstLauncherAdd, + $extra: inst.uuid, + ).go(context); + ModuleFramePage.of(context)?.openDrawer(); + }, + ), + UniversalIconButton( + icon: Icon(UniversalUI.of(context).icons.settings), + onPressed: () { + GeburaLibraryDetailRoute( + widget.item.uuid, + action: GeburaLibraryDetailActions.appInstEdit, + $extra: inst, + ).go(context); + ModuleFramePage.of(context)?.openDrawer(); + }, + ), + ], + ), children: [ - for (final launcher in launchers) - switch (launcher.launcherType) { - LocalAppInstLauncherType.steam => _steamItem( - context, - launcher, - launcher.steam != null && launchers.length == 1, - ), - LocalAppInstLauncherType.common => _localItem( - context, - inst, - launcher, - launcher.common != null && launchers.length == 1, - ), - }, + ...children, // if (launchers.isEmpty) // ListTile( // title: ElevatedButton( @@ -393,70 +499,64 @@ class _GeburaLibraryDetailInstList extends StatelessWidget { ], ); - listTiles.add(listTile); + instTiles.add(listTile); } - // if (state.ownedApps! - // .any((element) => element.assignedAppInfoId.id == item.id.id)) { - // listTiles.add( - // ListTile( - // title: ElevatedButton( - // onPressed: () async { - // unawaited( - // showDialog( - // context: context, - // builder: (_) { - // return BlocProvider.value( - // value: context.read(), - // child: NewLocalAppInstDialog( - // app: state.ownedApps!.firstWhere( - // (element) => - // element.assignedAppInfoId.id == item.id.id, - // ), - // newAppWithSameInfo: true, - // ), - // ); - // }, - // ), - // ); - // }, - // child: const Text('添加应用版本'), - // ), - // ), - // ); - // } else if (state.purchasedAppInfos! - // .any((element) => element.id.id == item.id.id)) { - // listTiles.add( - // ListTile( - // title: ElevatedButton( - // onPressed: () async { - // unawaited( - // showDialog( - // context: context, - // builder: (_) { - // return BlocProvider.value( - // value: context.read(), - // child: NewLocalAppInstDialog( - // app: App( - // name: item.name, - // assignedAppInfoId: item.id, - // ), - // newAppWithSameInfo: true, - // ), - // ); - // }, - // ), - // ); - // }, - // child: const Text('添加应用版本'), - // ), - // ), - // ); - // } - - return ListView( - shrinkWrap: true, - children: listTiles, + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + SpacingHelper.defaultDivider, + UniversalListTile( + title: const Text('本地文件'), + subtitle: Text(_onlyShowFavorites ? '${favoriteTiles.length} 个收藏' : '${appInsts.length} 个安装位置'), + leading: Icon(UniversalUI.of(context).icons.folder), + trailing: Wrap( + spacing: 8, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Text(_onlyShowFavorites ? '只看收藏' : '显示全部'), + UniversalSwitch( + value: _onlyShowFavorites, + onChanged: (value) { + setState(() { + _onlyShowFavorites = value; + }); + }, + ), + UniversalIconButton( + icon: Icon(UniversalUI.of(context).icons.add), + onPressed: () { + GeburaLibraryDetailRoute( + widget.item.uuid, + action: GeburaLibraryDetailActions.appInstAdd, + ).go(context); + ModuleFramePage.of(context)?.openDrawer(); + }, + ), + ], + ), + ), + if (_onlyShowFavorites) + ...favoriteTiles + else if (instTiles.length == 1) + instTiles.first + else + BootstrapContainer( + useWrap: true, + alignment: Alignment.topLeft, + fill: BootstrapSteps.xxl, + children: [ + ...instTiles.map( + (e) => BootstrapColumn( + fill: BootstrapSteps.md, + xxs: 12, + md: 6, + child: e, + ), + ), + ], + ), + ], ); }); } @@ -499,16 +599,17 @@ class _GeburaLibraryDetailAppSettingsState mainAxisAlignment: MainAxisAlignment.end, primaryItems: const [], secondaryItems: [ - // UniversalToolBarItem( - // label: const Text('编辑应用信息'), - // icon: UniversalUI.of(context).icons.settings, - // onPressed: () { - // // GeburaLibraryDetailRoute( - // // action: GeburaLibraryDetailActions.assignApp, - // // uuid: widget.item.uuid, - // // ).go(context); - // }, - // ), + UniversalToolBarItem( + label: const Text('编辑应用信息'), + icon: UniversalUI.of(context).icons.edit, + onPressed: () { + GeburaLibraryDetailRoute( + widget.item.uuid, + action: GeburaLibraryDetailActions.appEdit, + ).go(context); + ModuleFramePage.of(context)?.openDrawer(); + }, + ), UniversalToolBarItem( label: const Text('自动获取应用信息'), icon: UniversalUI.of(context).icons.automated, diff --git a/lib/view/pages/gebura/gebura_library_detail_app_inst_launcher_panel.dart b/lib/view/pages/gebura/gebura_library_detail_app_inst_launcher_panel.dart new file mode 100644 index 0000000..34d710a --- /dev/null +++ b/lib/view/pages/gebura/gebura_library_detail_app_inst_launcher_panel.dart @@ -0,0 +1,309 @@ +part of 'gebura_library_detail.dart'; + +class GeburaLibraryDetailAppInstLauncherAddPanel extends StatefulWidget { + const GeburaLibraryDetailAppInstLauncherAddPanel( + {super.key, required this.uuid, required this.inst}); + + final String uuid; + final LocalAppInst? inst; + + @override + State createState() => + _GeburaLibraryDetailAppInstLauncherAddPanelState(); +} + +class _GeburaLibraryDetailAppInstLauncherAddPanelState + extends State { + bool submitting = false; + String? msg; + + TextEditingController launcherPathController = TextEditingController(); + bool advancedTracing = false; + String processName = ''; + TextEditingController processPathController = TextEditingController(); + int sleepCount = 10; + + void _close(BuildContext context) { + ModuleFramePage.of(context)?.closeDrawer(); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + return RightPanelForm( + title: const Text('添加启动项'), + formFields: [ + UniversalTextFormField( + labelText: '启动路径', + controller: launcherPathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + launcherPathController.text = path; + } + }, + child: const Text('选择'), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return '不能为空'; + } + if (!Directory(value).existsSync()) { + return '路径不存在'; + } + if (widget.inst == null || + !widget.inst!.path.startsWith(value)) { + return '必须是安装位置的子目录'; + } + return null; + }, + ), + UniversalSwitchFormField( + title: const Text('高级模式'), + initialValue: advancedTracing, + onChanged: (value) => setState(() => advancedTracing = value), + ), + if (advancedTracing) ...[ + UniversalTextFormField( + labelText: '进程名', + initialValue: processName, + onChanged: (value) => setState(() => processName = value), + ), + UniversalTextFormField( + labelText: '进程路径', + controller: processPathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + processPathController.text = path; + } + }, + child: const Text('选择'), + ), + ), + UniversalTextFormField( + labelText: '等待时间(秒)', + initialValue: sleepCount.toString(), + onChanged: (value) => + setState(() => sleepCount = int.parse(value)), + ), + ], + ], + submitting: submitting, + onSubmit: widget.inst != null + ? () async { + setState(() { + submitting = true; + msg = null; + }); + msg = + await context.read().addLocalAppInstLauncher( + LocalAppInstLauncher( + uuid: const Uuid().v1(), + appInstUUID: widget.inst!.uuid, + launcherType: LocalAppInstLauncherType.common, + common: LocalAppInstLaunchCommon( + launcherPath: launcherPathController.text, + advancedTracing: advancedTracing, + processName: processName, + processPath: processPathController.text, + sleepCount: sleepCount, + ), + ), + ); + if (msg == null) { + _close(context); + } else { + setState(() { + submitting = false; + }); + } + } + : null, + errorMsg: msg, + close: () => _close(context), + ); + }, + ); + } +} + +class GeburaLibraryDetailAppInstLauncherEditPanel extends StatefulWidget { + const GeburaLibraryDetailAppInstLauncherEditPanel( + {super.key, required this.launcher}); + + final LocalAppInstLauncher? launcher; + + @override + State createState() => + _GeburaLibraryDetailAppInstLauncherEditPanelState(); +} + +class _GeburaLibraryDetailAppInstLauncherEditPanelState + extends State { + bool submitting = false; + String? msg; + + TextEditingController launcherPathController = TextEditingController(); + bool advancedTracing = false; + String processName = ''; + TextEditingController processPathController = TextEditingController(); + int sleepCount = 10; + + void _close(BuildContext context) { + ModuleFramePage.of(context)?.closeDrawer(); + } + + @override + void initState() { + super.initState(); + if (widget.launcher != null && widget.launcher!.common != null) { + final common = widget.launcher!.common!; + launcherPathController.text = common.launcherPath; + advancedTracing = common.advancedTracing; + processName = common.processName ?? ''; + processPathController.text = common.processPath ?? ''; + sleepCount = common.sleepCount ?? 10; + } + } + + LocalAppInstLauncher? get newSetting { + if (widget.launcher == null) { + return null; + } + return widget.launcher!.copyWith( + common: widget.launcher!.common?.copyWith( + launcherPath: launcherPathController.text, + advancedTracing: advancedTracing, + processName: processName, + processPath: processPathController.text, + sleepCount: sleepCount, + ), + ); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + return RightPanelForm( + title: const Text('编辑启动项'), + formFields: [ + UniversalTextFormField( + labelText: '启动路径', + controller: launcherPathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + launcherPathController.text = path; + } + }, + child: const Text('选择'), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return '不能为空'; + } + if (!Directory(value).existsSync()) { + return '路径不存在'; + } + if (!(widget.launcher?.common?.launcherPath.startsWith(value) ?? + false)) { + return '必须是安装位置的子目录'; + } + return null; + }, + ), + UniversalSwitchFormField( + title: const Text('高级模式'), + initialValue: advancedTracing, + onChanged: (value) => setState(() => advancedTracing = value), + ), + if (advancedTracing) ...[ + UniversalTextFormField( + labelText: '进程名', + initialValue: processName, + onChanged: (value) => setState(() => processName = value), + ), + UniversalTextFormField( + labelText: '进程路径', + controller: processPathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + processPathController.text = path; + } + }, + child: const Text('选择'), + ), + ), + UniversalTextFormField( + labelText: '等待时间(秒)', + initialValue: sleepCount.toString(), + onChanged: (value) => + setState(() => sleepCount = int.parse(value)), + ), + ], + Container( + margin: const EdgeInsets.only(top: 16), + child: UniversalElevatedButton( + onPressed: () async { + if (newSetting == null) { + return; + } + await Navigator.of(context).push( + UniversalPageRoute(builder: (context) { + return _GeburaAppLauncherSettingTestPage( + newSetting!, + ); + }), + ); + _close(context); + }, + child: const Text('遇到问题?打开调试窗口'), + ), + ), + ], + submitting: submitting, + onSubmit: widget.launcher != null + ? () async { + setState(() { + submitting = true; + msg = null; + }); + msg = await context + .read() + .updateLocalAppInstLauncher( + widget.launcher!.copyWith( + common: LocalAppInstLaunchCommon( + launcherPath: launcherPathController.text, + advancedTracing: advancedTracing, + processName: processName, + processPath: processPathController.text, + sleepCount: sleepCount, + ), + ), + ); + if (msg == null) { + _close(context); + } else { + setState(() { + submitting = false; + }); + } + } + : null, + errorMsg: msg, + close: () => _close(context), + ); + }, + ); + } +} diff --git a/lib/view/pages/gebura/gebura_library_detail_app_inst_panel.dart b/lib/view/pages/gebura/gebura_library_detail_app_inst_panel.dart new file mode 100644 index 0000000..524203c --- /dev/null +++ b/lib/view/pages/gebura/gebura_library_detail_app_inst_panel.dart @@ -0,0 +1,184 @@ +part of 'gebura_library_detail.dart'; + +class GeburaLibraryDetailAppInstAddPanel extends StatefulWidget { + const GeburaLibraryDetailAppInstAddPanel({super.key, required this.uuid}); + + final String uuid; + + @override + State createState() => + _GeburaLibraryDetailAppInstAddPanelState(); +} + +class _GeburaLibraryDetailAppInstAddPanelState + extends State { + @override + void initState() { + super.initState(); + name = ''; + path = ''; + version = ''; + } + + bool submitting = false; + String? msg; + + late String name; + late String path; + late String version; + + void _close(BuildContext context) { + ModuleFramePage.of(context)?.closeDrawer(); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + return RightPanelForm( + title: const Text('添加安装位置'), + formFields: [ + UniversalTextFormField( + labelText: '名称', + initialValue: name, + onChanged: (value) => setState(() => name = value), + ), + UniversalTextFormField( + labelText: '路径', + initialValue: path, + onChanged: (value) => setState(() => path = value), + validator: (value) { + if (value == null || value.isEmpty) { + return '不能为空'; + } + if (!Directory(value).existsSync()) { + return '路径不存在'; + } + return null; + }, + ), + UniversalTextFormField( + labelText: '版本', + initialValue: version, + onChanged: (value) => setState(() => version = value), + ), + ], + submitting: submitting, + onSubmit: () async { + setState(() { + submitting = true; + msg = null; + }); + msg = await context.read().addLocalAppInst( + LocalAppInst( + uuid: const Uuid().v1(), + appUUID: widget.uuid, + name: name, + path: path, + version: version, + ), + ); + if (msg == null) { + _close(context); + } else { + setState(() { + submitting = false; + }); + } + }, + errorMsg: msg, + close: () => _close(context), + ); + }, + ); + } +} + +class GeburaLibraryDetailAppInstEditPanel extends StatefulWidget { + const GeburaLibraryDetailAppInstEditPanel( + {super.key, required this.initialValue}); + + final LocalAppInst? initialValue; + + @override + State createState() => + _GeburaLibraryDetailAppInstEditPanelState(); +} + +class _GeburaLibraryDetailAppInstEditPanelState + extends State { + @override + void initState() { + super.initState(); + if (widget.initialValue != null) { + final app = widget.initialValue!; + name = app.name ?? ''; + path = app.path; + version = app.version; + } + } + + bool submitting = false; + String? msg; + + late String name; + late String path; + late String version; + + void _close(BuildContext context) { + ModuleFramePage.of(context)?.closeDrawer(); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + return RightPanelForm( + title: const Text('设置安装位置'), + formFields: [ + TextReadOnlyFormField( + label: '路径', + value: path, + ), + UniversalTextFormField( + labelText: '名称', + initialValue: name, + onChanged: (value) => setState(() => name = value), + ), + UniversalTextFormField( + labelText: '版本', + initialValue: version, + onChanged: (value) => setState(() => version = value), + ), + ], + submitting: submitting, + onSubmit: widget.initialValue != null + ? () async { + setState(() { + submitting = true; + msg = null; + }); + msg = await context + .read() + .updateLocalAppInst(widget.initialValue!.copyWith( + name: name, + version: version, + )); + if (msg == null) { + _close(context); + } else { + setState(() { + submitting = false; + }); + } + } + : null, + errorMsg: msg, + close: () => _close(context), + ); + }, + ); + } +} diff --git a/lib/view/pages/gebura/gebura_library_detail_app_panel.dart b/lib/view/pages/gebura/gebura_library_detail_app_panel.dart new file mode 100644 index 0000000..cd64d79 --- /dev/null +++ b/lib/view/pages/gebura/gebura_library_detail_app_panel.dart @@ -0,0 +1,211 @@ +part of 'gebura_library_detail.dart'; + +class GeburaLibraryDetailAppPanel extends StatefulWidget { + const GeburaLibraryDetailAppPanel({super.key, required this.uuid}); + + final String uuid; + + @override + State createState() => + _GeburaLibraryDetailAppPanelState(); +} + +class _GeburaLibraryDetailAppPanelState + extends State { + @override + void initState() { + super.initState(); + final app = context.read().state.libraryApps[widget.uuid] ?? + LocalApp(uuid: widget.uuid, name: ''); + name = app.name; + shortDescription = app.shortDescription ?? ''; + iconImageUrl = app.iconImageUrl ?? ''; + iconImagePathController.text = app.iconImagePath ?? ''; + backgroundImageUrl = app.backgroundImageUrl ?? ''; + backgroundImagePathController.text = app.backgroundImagePath ?? ''; + coverImageUrl = app.coverImageUrl ?? ''; + coverImagePathController.text = app.coverImagePath ?? ''; + description = app.description ?? ''; + releaseDate = app.releaseDate ?? ''; + developer = app.developer ?? ''; + publisher = app.publisher ?? ''; + } + + bool submitting = false; + String? msg; + + late String name; + late String shortDescription; + late String iconImageUrl; + final TextEditingController iconImagePathController = TextEditingController(); + late String backgroundImageUrl; + final TextEditingController backgroundImagePathController = + TextEditingController(); + late String coverImageUrl; + final TextEditingController coverImagePathController = + TextEditingController(); + late String description; + late String releaseDate; + late String developer; + late String publisher; + + void _close(BuildContext context) { + ModuleFramePage.of(context)?.closeDrawer(); + } + + @override + Widget build(BuildContext context) { + return BlocConsumer( + listener: (context, state) {}, + builder: (context, state) { + return RightPanelForm( + title: const Text('设置应用信息'), + formFields: [ + UniversalTextFormField( + labelText: '名称', + initialValue: name, + onChanged: (value) => setState(() => name = value), + ), + UniversalTextFormField( + labelText: '简介', + initialValue: shortDescription, + onChanged: (value) => setState(() => shortDescription = value), + ), + UniversalTextFormField( + labelText: '图标 URL', + initialValue: iconImageUrl, + onChanged: (value) => setState(() => iconImageUrl = value), + ), + UniversalTextFormField( + labelText: '图标文件', + controller: iconImagePathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + iconImagePathController.text = path; + } + }, + child: const Text('选择'), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return '不能为空'; + } + if (!Directory(value).existsSync()) { + return '路径不存在'; + } + return null; + }, + ), + UniversalTextFormField( + labelText: '背景图 URL', + initialValue: backgroundImageUrl, + onChanged: (value) => setState(() => backgroundImageUrl = value), + ), + UniversalTextFormField( + labelText: '背景图文件', + controller: backgroundImagePathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + backgroundImagePathController.text = path; + } + }, + child: const Text('选择'), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return '不能为空'; + } + if (!Directory(value).existsSync()) { + return '路径不存在'; + } + return null; + }, + ), + UniversalTextFormField( + labelText: '封面图 URL', + initialValue: coverImageUrl, + onChanged: (value) => setState(() => coverImageUrl = value), + ), + UniversalTextFormField( + labelText: '封面图文件', + controller: coverImagePathController, + suffixIcon: UniversalTextButton( + onPressed: () async { + final path = await FilePicker.platform.getDirectoryPath(); + if (path != null) { + coverImagePathController.text = path; + } + }, + child: const Text('选择'), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return '不能为空'; + } + if (!Directory(value).existsSync()) { + return '路径不存在'; + } + return null; + }, + ), + UniversalTextFormField( + labelText: '描述', + initialValue: description, + onChanged: (value) => setState(() => description = value), + ), + UniversalTextFormField( + labelText: '发布日期', + initialValue: releaseDate, + onChanged: (value) => setState(() => releaseDate = value), + ), + UniversalTextFormField( + labelText: '开发者', + initialValue: developer, + onChanged: (value) => setState(() => developer = value), + ), + UniversalTextFormField( + labelText: '发布者', + initialValue: publisher, + onChanged: (value) => setState(() => publisher = value), + ), + ], + submitting: submitting, + onSubmit: () async { + setState(() { + submitting = true; + msg = null; + }); + msg = await context.read().updateLocalApp(LocalApp( + uuid: widget.uuid, + name: name, + shortDescription: shortDescription, + iconImageUrl: iconImageUrl, + iconImagePath: iconImagePathController.text, + backgroundImageUrl: backgroundImageUrl, + backgroundImagePath: backgroundImagePathController.text, + coverImageUrl: coverImageUrl, + coverImagePath: coverImagePathController.text, + description: description, + releaseDate: releaseDate, + developer: developer, + publisher: publisher, + )); + if (msg == null) { + _close(context); + } else { + setState(() { + submitting = false; + }); + } + }, + errorMsg: msg, + close: () => _close(context), + ); + }, + ); + } +} diff --git a/lib/view/pages/gebura/gebura_app_launcher_setting_dialog.dart b/lib/view/pages/gebura/gebura_library_detail_launcher_setting_dialog.dart similarity index 79% rename from lib/view/pages/gebura/gebura_app_launcher_setting_dialog.dart rename to lib/view/pages/gebura/gebura_library_detail_launcher_setting_dialog.dart index 95e2820..2e76575 100644 --- a/lib/view/pages/gebura/gebura_app_launcher_setting_dialog.dart +++ b/lib/view/pages/gebura/gebura_library_detail_launcher_setting_dialog.dart @@ -1,117 +1,9 @@ -import 'package:dao/dao.dart'; -import 'package:file_picker/file_picker.dart' as file_picker; -import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; - -import '../../../bloc/gebura/gebura_bloc.dart'; -import '../../components/input_formatters.dart'; -import '../../components/pop_alert.dart'; -import '../../components/toast.dart'; -import '../../layout/bootstrap_container.dart'; -import '../../universal/universal.dart'; - -class GeburaAppLauncherSettingDialog extends StatefulWidget { - const GeburaAppLauncherSettingDialog(this.launcher, this.navigator, - {super.key}); - - final NavigatorState navigator; - final LocalAppInstLauncher launcher; - - @override - State createState() => - GeburaAppLauncherSettingDialogState(); -} - -class GeburaAppLauncherSettingDialogState - extends State { - LocalAppInstLaunchCommon? newSetting; - final heroTag = UniqueKey(); - - @override - Widget build(BuildContext context) { - return BlocConsumer( - listener: (context, state) { - if (state is GeburaSaveLocalAppInstLaunchSettingState && - state.success) { - Navigator.of(context).pop(); - } - }, - builder: (context, state) { - return UniversalDialog( - title: const Text('本地设置'), - content: SizedBox( - width: 600, - child: SingleChildScrollView( - child: Container( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - _GeburaAppLauncherSettingForm( - widget.launcher.uuid, - newSetting ?? widget.launcher.common, - onChanged: (setting) { - setState(() { - newSetting = setting; - }); - }, - ), - Container( - margin: const EdgeInsets.only(top: 16), - child: UniversalElevatedButton( - onPressed: () async { - Navigator.of(context).pop(); - await widget.navigator.push( - UniversalPageRoute(builder: (context) { - return _GeburaAppLauncherSettingTestPage( - widget.launcher.copyWith( - common: newSetting ?? widget.launcher.common, - ), - heroTag, - ); - }), - ); - }, - child: const Text('遇到问题?打开调试窗口'), - ), - ), - ], - ), - ), - ), - ), - actions: [ - UniversalDialogAction( - onPressed: newSetting != null - ? () { - context.read().add( - GeburaSaveLocalAppInstLaunchSettingEvent( - widget.launcher.uuid, - commonSetting: newSetting), - ); - } - : null, - isPrimary: true, - child: const Text('保存'), - ), - UniversalDialogAction( - onPressed: () { - Navigator.pop(context); //close Dialog - }, - child: const Text('取消'), - ) - ], - ); - }, - ); - } -} +part of 'gebura_library_detail.dart'; class _GeburaAppLauncherSettingTestPage extends StatefulWidget { - const _GeburaAppLauncherSettingTestPage(this.launcher, this.heroTag); + const _GeburaAppLauncherSettingTestPage(this.launcher); final LocalAppInstLauncher launcher; - final UniqueKey heroTag; @override State<_GeburaAppLauncherSettingTestPage> createState() => @@ -441,7 +333,7 @@ class _GeburaAppLauncherSettingFormState title: const Text('高级模式'), initialValue: advancedTracing, ), - if (advancedTracing) + if (advancedTracing) ...[ UniversalTextFormField( initialValue: processName, labelText: '进程名', @@ -449,7 +341,6 @@ class _GeburaAppLauncherSettingFormState maxLines: null, onChanged: (_) => onChanged, ), - if (advancedTracing) UniversalTextFormField( controller: processPathController, suffixIcon: UniversalTextButton( @@ -467,7 +358,6 @@ class _GeburaAppLauncherSettingFormState maxLines: null, onChanged: (_) => onChanged, ), - if (advancedTracing) UniversalTextFormField( initialValue: sleepCount.toString(), labelText: '等待时间(秒)', @@ -484,6 +374,7 @@ class _GeburaAppLauncherSettingFormState }, maxLines: null, ), + ], ], ), ), diff --git a/lib/view/pages/gebura/gebura_library_settings.dart b/lib/view/pages/gebura/gebura_library_settings.dart index b5e2407..ca16596 100644 --- a/lib/view/pages/gebura/gebura_library_settings.dart +++ b/lib/view/pages/gebura/gebura_library_settings.dart @@ -34,8 +34,8 @@ import '../frame_page.dart'; part 'gebura_library_settings_common.dart'; part 'gebura_library_settings_steam.dart'; -class GeburaLibrarySettings extends StatelessWidget { - const GeburaLibrarySettings({super.key}); +class GeburaLibrarySettingsPage extends StatelessWidget { + const GeburaLibrarySettingsPage({super.key}); Widget _buildCommonItem( BuildContext context, @@ -64,8 +64,7 @@ class GeburaLibrarySettings extends StatelessWidget { label: const Text('详情'), onPressed: () { GeburaLibrarySettingsRoute( - action: - GeburaLibrarySettingsActions.commonAppScanResult, + action: GeburaLibrarySettingsActions.appScanResult, $extra: item.uuid) .go(context); ModuleFramePage.of(context)?.openDrawer(); @@ -100,6 +99,10 @@ class GeburaLibrarySettings extends StatelessWidget { await OpenFile.open(item.path); }, ), + UniversalToolBarItem( + icon: UniversalUI.of(context).icons.delete, + label: const Text('删除'), + ) ], ), ), diff --git a/lib/view/pages/gebura/gebura_library_settings_common.dart b/lib/view/pages/gebura/gebura_library_settings_common.dart index 9d7c9d8..cb8073b 100644 --- a/lib/view/pages/gebura/gebura_library_settings_common.dart +++ b/lib/view/pages/gebura/gebura_library_settings_common.dart @@ -21,6 +21,7 @@ class _CommonAppFolderScanSettingPageState basePath: '', ); + uuid = initialValue.uuid; basePath = initialValue.basePath; excludeDirectoryMatchers = initialValue.excludeDirectoryMatchers; minInstallDirDepth = initialValue.minInstallDirDepth; @@ -45,13 +46,13 @@ class _CommonAppFolderScanSettingPageState Future _saveAndExit(BuildContext context) async { if (_formKey.currentState!.validate()) { _formKey.currentState!.save(); - final success = await context + final msg = await context .read() .saveLocalCommonAppLibraryFolder(setting); - if (success) { + if (msg == null) { Navigator.of(context).pop(); } else { - Toast(title: '', message: '保存失败').show(context); + Toast(title: '', message: '保存失败 $msg').show(context); } } } @@ -73,6 +74,7 @@ class _CommonAppFolderScanSettingPageState CommonAppScan get setting { _constructPathFieldMatcher(); return CommonAppScan( + uuid: uuid, basePath: basePath, excludeDirectoryMatchers: excludeDirectoryMatchers, minInstallDirDepth: minInstallDirDepth, @@ -83,10 +85,10 @@ class _CommonAppFolderScanSettingPageState excludeExecutableMatchers: excludeExecutableMatchers, minExecutableDepth: minExecutableDepth, maxExecutableDepth: maxExecutableDepth, - uuid: '', ); } + late String uuid; late String basePath; late List excludeDirectoryMatchers; late int minInstallDirDepth; @@ -619,6 +621,7 @@ class _CommonAppFolderScanSettingPageState if (_formKey.currentState!.validate()) { _formKey.currentState!.save(); } + await _saveAndExit(context); }, label: const Text('提交'), icon: Icon(UniversalUI.of(context).icons.check), diff --git a/lib/view/specialized/right_panel_form.dart b/lib/view/specialized/right_panel_form.dart index 0e9c4df..8f57eeb 100644 --- a/lib/view/specialized/right_panel_form.dart +++ b/lib/view/specialized/right_panel_form.dart @@ -122,7 +122,7 @@ class _RightPanelFormState extends State { } }, child: widget.submitting ?? false - ? const CircularProgressIndicator() + ? const UniversalCircularProgressIndicator() : Text(S.of(context).submit), ), UniversalElevatedButton( @@ -237,24 +237,22 @@ class TextReadOnlyFormField extends StatelessWidget { @override Widget build(BuildContext context) { - return TextFormField( + return UniversalTextFormField( initialValue: value, readOnly: true, - decoration: InputDecoration( - labelText: label, - prefixIcon: UniversalIconButton( - icon: Icon(UniversalUI.of(context).icons.lock), - onPressed: () { - const Toast(title: '', message: '该项目无法修改').show(context); - }), - suffixIcon: UniversalIconButton( - icon: Icon(UniversalUI.of(context).icons.copy), - onPressed: () async { - await Clipboard.setData(ClipboardData(text: value)).then((value) { - const Toast(title: '', message: '已复制').show(context); - }); - }, - ), + labelText: label, + prefixIcon: UniversalIconButton( + icon: Icon(UniversalUI.of(context).icons.lock), + onPressed: () { + const Toast(title: '', message: '该项目无法修改').show(context); + }), + suffixIcon: UniversalIconButton( + icon: Icon(UniversalUI.of(context).icons.copy), + onPressed: () async { + await Clipboard.setData(ClipboardData(text: value)).then((value) { + const Toast(title: '', message: '已复制').show(context); + }); + }, ), ); } diff --git a/lib/view/universal/button.dart b/lib/view/universal/button.dart index 5328c36..2ea4a0f 100644 --- a/lib/view/universal/button.dart +++ b/lib/view/universal/button.dart @@ -6,7 +6,7 @@ import 'common.dart'; class UniversalOutlinedButton extends StatelessWidget { const UniversalOutlinedButton({ super.key, - required this.onPressed, + this.onPressed, this.onLongPress, this.focusNode, this.autofocus = false, @@ -14,7 +14,7 @@ class UniversalOutlinedButton extends StatelessWidget { required this.child, }); - final VoidCallback onPressed; + final VoidCallback? onPressed; final VoidCallback? onLongPress; final FocusNode? focusNode; final bool autofocus; @@ -41,14 +41,23 @@ class UniversalOutlinedButton extends StatelessWidget { onLongPress: onLongPress, focusNode: focusNode, autofocus: autofocus, - child: child, + child: icon != null + ? Wrap( + spacing: 8, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + icon!, + child, + ], + ) + : child, ); } } factory UniversalOutlinedButton.icon({ Key? key, - required VoidCallback? onPressed, + VoidCallback? onPressed, VoidCallback? onLongPress, FocusNode? focusNode, bool? autofocus, @@ -57,7 +66,7 @@ class UniversalOutlinedButton extends StatelessWidget { }) { return UniversalOutlinedButton( key: key, - onPressed: onPressed!, + onPressed: onPressed, onLongPress: onLongPress, focusNode: focusNode, autofocus: autofocus ?? false, @@ -76,6 +85,7 @@ class UniversalElevatedButton extends StatelessWidget { this.autofocus = false, this.icon, this.backgroundColor, + this.padding, required this.child, }); @@ -86,6 +96,7 @@ class UniversalElevatedButton extends StatelessWidget { final Widget? icon; final Widget child; final Color? backgroundColor; + final EdgeInsetsGeometry? padding; @override Widget build(BuildContext context) { @@ -102,7 +113,10 @@ class UniversalElevatedButton extends StatelessWidget { style: material.ElevatedButton.styleFrom( backgroundColor: backgroundColor, ), - label: child, + label: Container( + padding: padding, + child: child, + ), ); case UIDesign.fluent: return fluent.FilledButton( @@ -114,7 +128,19 @@ class UniversalElevatedButton extends StatelessWidget { backgroundColor: fluent.WidgetStateProperty.all(backgroundColor), ), - child: child, + child: Container( + padding: padding, + child: icon != null + ? Wrap( + spacing: 8, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + icon!, + child, + ], + ) + : child, + ), ); } } @@ -126,6 +152,7 @@ class UniversalElevatedButton extends StatelessWidget { FocusNode? focusNode, bool? autofocus, Widget? icon, + EdgeInsetsGeometry? padding, required Widget label, }) { return UniversalElevatedButton( @@ -135,6 +162,7 @@ class UniversalElevatedButton extends StatelessWidget { focusNode: focusNode, autofocus: autofocus ?? false, icon: icon, + padding: padding, child: label, ); } @@ -185,7 +213,7 @@ class UniversalTextButton extends StatelessWidget { factory UniversalTextButton.icon({ Key? key, - required VoidCallback? onPressed, + VoidCallback? onPressed, VoidCallback? onLongPress, FocusNode? focusNode, bool? autofocus, diff --git a/lib/view/universal/dialog.dart b/lib/view/universal/dialog.dart index 7c59221..1576b12 100644 --- a/lib/view/universal/dialog.dart +++ b/lib/view/universal/dialog.dart @@ -15,6 +15,22 @@ class UniversalDialog extends StatelessWidget { final Widget? content; final List? actions; + Future show(BuildContext context) async { + final design = UniversalUI.of(context).design; + switch (design) { + case UIDesign.material: + await material.showDialog( + context: context, + builder: (context) => this, + ); + case UIDesign.fluent: + await fluent.showDialog( + context: context, + builder: (context) => this, + ); + } + } + @override Widget build(BuildContext context) { final design = UniversalUI.of(context).design; diff --git a/lib/view/universal/icons.dart b/lib/view/universal/icons.dart index 05e3e9a..8ad62df 100644 --- a/lib/view/universal/icons.dart +++ b/lib/view/universal/icons.dart @@ -337,4 +337,22 @@ class UniversalIcon { return FluentIcons.bot_24_regular; } } + + IconData get favorite { + switch (design) { + case UIDesign.material: + return material.Icons.favorite; + case UIDesign.fluent: + return FluentIcons.star_24_filled; + } + } + + IconData get favoriteBorder { + switch (design) { + case UIDesign.material: + return material.Icons.favorite_border; + case UIDesign.fluent: + return FluentIcons.star_24_regular; + } + } } diff --git a/lib/view/universal/spacing.dart b/lib/view/universal/spacing.dart index bf122a8..0c4978f 100644 --- a/lib/view/universal/spacing.dart +++ b/lib/view/universal/spacing.dart @@ -32,9 +32,9 @@ class _DefaultDivider extends StatelessWidget { @override Widget build(BuildContext context) { return Divider( - height: 10, - indent: 20, - endIndent: 20, + height: 8, + indent: 10, + endIndent: 10, thickness: 2, color: Theme.of(context).brightness == Brightness.dark ? Theme.of(context).colorScheme.outline diff --git a/packages/dao/drift_schemas/main_database/drift_schema_v1.json b/packages/dao/drift_schemas/main_database/drift_schema_v1.json index 8b1aa6b..fe485a2 100644 --- a/packages/dao/drift_schemas/main_database/drift_schema_v1.json +++ b/packages/dao/drift_schemas/main_database/drift_schema_v1.json @@ -1 +1 @@ -{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"k_v_table","was_declared_in_moor":false,"columns":[{"name":"bucket","getter_name":"bucket","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"key","getter_name":"key","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"value","getter_name":"value","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["bucket","key"]}},{"id":1,"references":[],"type":"table","data":{"name":"feed_config_table","was_declared_in_moor":false,"columns":[{"name":"internal_id","getter_name":"internalId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"json_data","getter_name":"jsonData","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["internal_id"]}},{"id":2,"references":[],"type":"table","data":{"name":"local_app_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"last_launched_inst_u_u_i_d","getter_name":"lastLaunchedInstUUID","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"short_description","getter_name":"shortDescription","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"icon_image_url","getter_name":"iconImageUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"icon_image_path","getter_name":"iconImagePath","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"background_image_url","getter_name":"backgroundImageUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"background_image_path","getter_name":"backgroundImagePath","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"cover_image_url","getter_name":"coverImageUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"cover_image_path","getter_name":"coverImagePath","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"description","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"release_date","getter_name":"releaseDate","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"developer","getter_name":"developer","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"publisher","getter_name":"publisher","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"local_app_inst_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"app_u_u_i_d","getter_name":"appUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"path","getter_name":"path","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"version","getter_name":"version","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"last_launched_launcher_u_u_i_d","getter_name":"lastLaunchedLauncherUUID","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[],"type":"table","data":{"name":"local_app_inst_launcher_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"app_inst_u_u_i_d","getter_name":"appInstUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"launcher_type","getter_name":"launcherType","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(LocalAppInstLauncherType.values)","dart_type_name":"LocalAppInstLauncherType"}},{"name":"common","getter_name":"common","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const LocalAppInstLaunchCommonConverter()","dart_type_name":"LocalAppInstLaunchCommon"}},{"name":"steam","getter_name":"steam","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const LocalAppInstLaunchSteamConverter()","dart_type_name":"LocalAppInstLaunchSteam"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"local_common_app_scan_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"base_path","getter_name":"basePath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"enable_auto_scan","getter_name":"enableAutoScan","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"enable_auto_scan\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"enable_auto_scan\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"exclude_directory_matchers","getter_name":"excludeDirectoryMatchers","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"min_install_dir_depth","getter_name":"minInstallDirDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"max_install_dir_depth","getter_name":"maxInstallDirDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"path_field_matcher","getter_name":"pathFieldMatcher","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EnumListConverter(() => LocalCommonAppScanPathFieldMatcher.values)","dart_type_name":"List"}},{"name":"path_field_matcher_alignment","getter_name":"pathFieldMatcherAlignment","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(LocalCommonAppScanPathFieldMatcherAlignment.values)","dart_type_name":"LocalCommonAppScanPathFieldMatcherAlignment"}},{"name":"include_executable_matchers","getter_name":"includeExecutableMatchers","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"exclude_executable_matchers","getter_name":"excludeExecutableMatchers","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"min_executable_depth","getter_name":"minExecutableDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"max_executable_depth","getter_name":"maxExecutableDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[],"type":"table","data":{"name":"local_common_app_scan_result_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"scan_u_u_i_d","getter_name":"scanUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"version","getter_name":"version","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"install_path","getter_name":"installPath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"launcher_paths","getter_name":"launcherPaths","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":7,"references":[],"type":"table","data":{"name":"local_steam_app_scan_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"library_path","getter_name":"libraryPath","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"enable_auto_scan","getter_name":"enableAutoScan","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"enable_auto_scan\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"enable_auto_scan\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":8,"references":[],"type":"table","data":{"name":"local_steam_app_scan_result_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"scan_u_u_i_d","getter_name":"scanUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"steam_app_i_d","getter_name":"steamAppID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"install_path","getter_name":"installPath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"launcher_path","getter_name":"launcherPath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"size_on_disk","getter_name":"sizeOnDisk","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":9,"references":[2],"type":"index","data":{"on":2,"name":"local_app_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":10,"references":[3],"type":"index","data":{"on":3,"name":"local_app_inst_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":11,"references":[3],"type":"index","data":{"on":3,"name":"local_app_inst_app_uuid","sql":null,"unique":false,"columns":["app_u_u_i_d"]}},{"id":12,"references":[4],"type":"index","data":{"on":4,"name":"local_app_inst_launcher_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":13,"references":[4],"type":"index","data":{"on":4,"name":"local_app_inst_launcher_app_inst_uuid","sql":null,"unique":false,"columns":["app_inst_u_u_i_d"]}},{"id":14,"references":[5],"type":"index","data":{"on":5,"name":"local_common_app_scan_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":15,"references":[5],"type":"index","data":{"on":5,"name":"local_common_app_scan_base_path","sql":null,"unique":false,"columns":["base_path"]}},{"id":16,"references":[6],"type":"index","data":{"on":6,"name":"local_common_app_scan_result_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":17,"references":[6],"type":"index","data":{"on":6,"name":"local_common_app_scan_result_scan_uuid","sql":null,"unique":false,"columns":["scan_u_u_i_d"]}},{"id":18,"references":[7],"type":"index","data":{"on":7,"name":"local_steam_app_scan_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":19,"references":[8],"type":"index","data":{"on":8,"name":"local_steam_app_scan_result_scan_uuid","sql":null,"unique":false,"columns":["scan_u_u_i_d"]}}]} \ No newline at end of file +{"_meta":{"description":"This file contains a serialized version of schema entities for drift.","version":"1.2.0"},"options":{"store_date_time_values_as_text":false},"entities":[{"id":0,"references":[],"type":"table","data":{"name":"k_v_table","was_declared_in_moor":false,"columns":[{"name":"bucket","getter_name":"bucket","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"key","getter_name":"key","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"value","getter_name":"value","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["bucket","key"]}},{"id":1,"references":[],"type":"table","data":{"name":"feed_config_table","was_declared_in_moor":false,"columns":[{"name":"internal_id","getter_name":"internalId","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"category","getter_name":"category","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"json_data","getter_name":"jsonData","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[],"explicit_pk":["internal_id"]}},{"id":2,"references":[],"type":"table","data":{"name":"local_app_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"last_launched_inst_u_u_i_d","getter_name":"lastLaunchedInstUUID","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"short_description","getter_name":"shortDescription","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"icon_image_url","getter_name":"iconImageUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"icon_image_path","getter_name":"iconImagePath","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"background_image_url","getter_name":"backgroundImageUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"background_image_path","getter_name":"backgroundImagePath","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"cover_image_url","getter_name":"coverImageUrl","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"cover_image_path","getter_name":"coverImagePath","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"description","getter_name":"description","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"release_date","getter_name":"releaseDate","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"developer","getter_name":"developer","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"publisher","getter_name":"publisher","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":3,"references":[],"type":"table","data":{"name":"local_app_inst_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"app_u_u_i_d","getter_name":"appUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"path","getter_name":"path","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"version","getter_name":"version","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"last_launched_launcher_u_u_i_d","getter_name":"lastLaunchedLauncherUUID","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":4,"references":[],"type":"table","data":{"name":"local_app_inst_launcher_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"app_inst_u_u_i_d","getter_name":"appInstUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"launcher_type","getter_name":"launcherType","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumIndexConverter(LocalAppInstLauncherType.values)","dart_type_name":"LocalAppInstLauncherType"}},{"name":"favorite","getter_name":"favorite","moor_type":"bool","nullable":true,"customConstraints":null,"defaultConstraints":"CHECK (\"favorite\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"favorite\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"common","getter_name":"common","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const LocalAppInstLaunchCommonConverter()","dart_type_name":"LocalAppInstLaunchCommon"}},{"name":"steam","getter_name":"steam","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const LocalAppInstLaunchSteamConverter()","dart_type_name":"LocalAppInstLaunchSteam"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":5,"references":[],"type":"table","data":{"name":"local_common_app_scan_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"base_path","getter_name":"basePath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"enable_auto_scan","getter_name":"enableAutoScan","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"enable_auto_scan\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"enable_auto_scan\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"exclude_directory_matchers","getter_name":"excludeDirectoryMatchers","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"min_install_dir_depth","getter_name":"minInstallDirDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"max_install_dir_depth","getter_name":"maxInstallDirDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"path_field_matcher","getter_name":"pathFieldMatcher","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"EnumListConverter(() => LocalCommonAppScanPathFieldMatcher.values)","dart_type_name":"List"}},{"name":"path_field_matcher_alignment","getter_name":"pathFieldMatcherAlignment","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const EnumNameConverter(LocalCommonAppScanPathFieldMatcherAlignment.values)","dart_type_name":"LocalCommonAppScanPathFieldMatcherAlignment"}},{"name":"include_executable_matchers","getter_name":"includeExecutableMatchers","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"exclude_executable_matchers","getter_name":"excludeExecutableMatchers","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}},{"name":"min_executable_depth","getter_name":"minExecutableDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"max_executable_depth","getter_name":"maxExecutableDepth","moor_type":"int","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":6,"references":[],"type":"table","data":{"name":"local_common_app_scan_result_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"scan_u_u_i_d","getter_name":"scanUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"version","getter_name":"version","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"install_path","getter_name":"installPath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"launcher_paths","getter_name":"launcherPaths","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[],"type_converter":{"dart_expr":"const StringListConverter()","dart_type_name":"List"}}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":7,"references":[],"type":"table","data":{"name":"local_steam_app_scan_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"library_path","getter_name":"libraryPath","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"enable_auto_scan","getter_name":"enableAutoScan","moor_type":"bool","nullable":false,"customConstraints":null,"defaultConstraints":"CHECK (\"enable_auto_scan\" IN (0, 1))","dialectAwareDefaultConstraints":{"sqlite":"CHECK (\"enable_auto_scan\" IN (0, 1))"},"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":8,"references":[],"type":"table","data":{"name":"local_steam_app_scan_result_table","was_declared_in_moor":false,"columns":[{"name":"id","getter_name":"id","moor_type":"int","nullable":false,"customConstraints":null,"defaultConstraints":"PRIMARY KEY AUTOINCREMENT","dialectAwareDefaultConstraints":{"sqlite":"PRIMARY KEY AUTOINCREMENT"},"default_dart":null,"default_client_dart":null,"dsl_features":["auto-increment"]},{"name":"uuid","getter_name":"uuid","moor_type":"string","nullable":false,"customConstraints":null,"defaultConstraints":"UNIQUE","dialectAwareDefaultConstraints":{"sqlite":"UNIQUE"},"default_dart":null,"default_client_dart":null,"dsl_features":["unknown"]},{"name":"scan_u_u_i_d","getter_name":"scanUUID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"steam_app_i_d","getter_name":"steamAppID","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"name","getter_name":"name","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"install_path","getter_name":"installPath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"launcher_path","getter_name":"launcherPath","moor_type":"string","nullable":false,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]},{"name":"size_on_disk","getter_name":"sizeOnDisk","moor_type":"string","nullable":true,"customConstraints":null,"default_dart":null,"default_client_dart":null,"dsl_features":[]}],"is_virtual":false,"without_rowid":false,"constraints":[]}},{"id":9,"references":[2],"type":"index","data":{"on":2,"name":"local_app_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":10,"references":[3],"type":"index","data":{"on":3,"name":"local_app_inst_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":11,"references":[3],"type":"index","data":{"on":3,"name":"local_app_inst_app_uuid","sql":null,"unique":false,"columns":["app_u_u_i_d"]}},{"id":12,"references":[4],"type":"index","data":{"on":4,"name":"local_app_inst_launcher_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":13,"references":[4],"type":"index","data":{"on":4,"name":"local_app_inst_launcher_app_inst_uuid","sql":null,"unique":false,"columns":["app_inst_u_u_i_d"]}},{"id":14,"references":[5],"type":"index","data":{"on":5,"name":"local_common_app_scan_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":15,"references":[5],"type":"index","data":{"on":5,"name":"local_common_app_scan_base_path","sql":null,"unique":false,"columns":["base_path"]}},{"id":16,"references":[6],"type":"index","data":{"on":6,"name":"local_common_app_scan_result_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":17,"references":[6],"type":"index","data":{"on":6,"name":"local_common_app_scan_result_scan_uuid","sql":null,"unique":false,"columns":["scan_u_u_i_d"]}},{"id":18,"references":[7],"type":"index","data":{"on":7,"name":"local_steam_app_scan_uuid","sql":null,"unique":false,"columns":["uuid"]}},{"id":19,"references":[8],"type":"index","data":{"on":8,"name":"local_steam_app_scan_result_scan_uuid","sql":null,"unique":false,"columns":["scan_u_u_i_d"]}}]} \ No newline at end of file diff --git a/packages/dao/lib/src/database.g.dart b/packages/dao/lib/src/database.g.dart index 2d7f045..ecdc2cc 100644 --- a/packages/dao/lib/src/database.g.dart +++ b/packages/dao/lib/src/database.g.dart @@ -1247,6 +1247,15 @@ class $LocalAppInstLauncherTableTable extends LocalAppInstLauncherTable type: DriftSqlType.int, requiredDuringInsert: true) .withConverter( $LocalAppInstLauncherTableTable.$converterlauncherType); + static const VerificationMeta _favoriteMeta = + const VerificationMeta('favorite'); + @override + late final GeneratedColumn favorite = GeneratedColumn( + 'favorite', aliasedName, true, + type: DriftSqlType.bool, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("favorite" IN (0, 1))')); static const VerificationMeta _commonMeta = const VerificationMeta('common'); @override late final GeneratedColumnWithTypeConverter @@ -1263,7 +1272,7 @@ class $LocalAppInstLauncherTableTable extends LocalAppInstLauncherTable $LocalAppInstLauncherTableTable.$convertersteamn); @override List get $columns => - [id, uuid, appInstUUID, launcherType, common, steam]; + [id, uuid, appInstUUID, launcherType, favorite, common, steam]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -1293,6 +1302,10 @@ class $LocalAppInstLauncherTableTable extends LocalAppInstLauncherTable context.missing(_appInstUUIDMeta); } context.handle(_launcherTypeMeta, const VerificationResult.success()); + if (data.containsKey('favorite')) { + context.handle(_favoriteMeta, + favorite.isAcceptableOrUnknown(data['favorite']!, _favoriteMeta)); + } context.handle(_commonMeta, const VerificationResult.success()); context.handle(_steamMeta, const VerificationResult.success()); return context; @@ -1311,6 +1324,8 @@ class $LocalAppInstLauncherTableTable extends LocalAppInstLauncherTable launcherType: $LocalAppInstLauncherTableTable.$converterlauncherType .fromSql(attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}launcher_type'])!), + favorite: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}favorite']), common: $LocalAppInstLauncherTableTable.$convertercommonn.fromSql( attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}common'])), @@ -1345,6 +1360,7 @@ class LocalAppInstLauncherTableCompanion final Value uuid; final Value appInstUUID; final Value launcherType; + final Value favorite; final Value common; final Value steam; const LocalAppInstLauncherTableCompanion({ @@ -1352,6 +1368,7 @@ class LocalAppInstLauncherTableCompanion this.uuid = const Value.absent(), this.appInstUUID = const Value.absent(), this.launcherType = const Value.absent(), + this.favorite = const Value.absent(), this.common = const Value.absent(), this.steam = const Value.absent(), }); @@ -1360,6 +1377,7 @@ class LocalAppInstLauncherTableCompanion required String uuid, required String appInstUUID, required LocalAppInstLauncherType launcherType, + this.favorite = const Value.absent(), this.common = const Value.absent(), this.steam = const Value.absent(), }) : uuid = Value(uuid), @@ -1370,6 +1388,7 @@ class LocalAppInstLauncherTableCompanion Expression? uuid, Expression? appInstUUID, Expression? launcherType, + Expression? favorite, Expression? common, Expression? steam, }) { @@ -1378,6 +1397,7 @@ class LocalAppInstLauncherTableCompanion if (uuid != null) 'uuid': uuid, if (appInstUUID != null) 'app_inst_u_u_i_d': appInstUUID, if (launcherType != null) 'launcher_type': launcherType, + if (favorite != null) 'favorite': favorite, if (common != null) 'common': common, if (steam != null) 'steam': steam, }); @@ -1388,6 +1408,7 @@ class LocalAppInstLauncherTableCompanion Value? uuid, Value? appInstUUID, Value? launcherType, + Value? favorite, Value? common, Value? steam}) { return LocalAppInstLauncherTableCompanion( @@ -1395,6 +1416,7 @@ class LocalAppInstLauncherTableCompanion uuid: uuid ?? this.uuid, appInstUUID: appInstUUID ?? this.appInstUUID, launcherType: launcherType ?? this.launcherType, + favorite: favorite ?? this.favorite, common: common ?? this.common, steam: steam ?? this.steam, ); @@ -1417,6 +1439,9 @@ class LocalAppInstLauncherTableCompanion .$converterlauncherType .toSql(launcherType.value)); } + if (favorite.present) { + map['favorite'] = Variable(favorite.value); + } if (common.present) { map['common'] = Variable($LocalAppInstLauncherTableTable .$convertercommonn @@ -1436,6 +1461,7 @@ class LocalAppInstLauncherTableCompanion ..write('uuid: $uuid, ') ..write('appInstUUID: $appInstUUID, ') ..write('launcherType: $launcherType, ') + ..write('favorite: $favorite, ') ..write('common: $common, ') ..write('steam: $steam') ..write(')')) @@ -3530,6 +3556,7 @@ typedef $$LocalAppInstLauncherTableTableCreateCompanionBuilder required String uuid, required String appInstUUID, required LocalAppInstLauncherType launcherType, + Value favorite, Value common, Value steam, }); @@ -3539,6 +3566,7 @@ typedef $$LocalAppInstLauncherTableTableUpdateCompanionBuilder Value uuid, Value appInstUUID, Value launcherType, + Value favorite, Value common, Value steam, }); @@ -3567,6 +3595,9 @@ class $$LocalAppInstLauncherTableTableFilterComposer column: $table.launcherType, builder: (column) => ColumnWithTypeConverterFilters(column)); + ColumnFilters get favorite => $composableBuilder( + column: $table.favorite, builder: (column) => ColumnFilters(column)); + ColumnWithTypeConverterFilters get common => $composableBuilder( @@ -3602,6 +3633,9 @@ class $$LocalAppInstLauncherTableTableOrderingComposer column: $table.launcherType, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get favorite => $composableBuilder( + column: $table.favorite, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get common => $composableBuilder( column: $table.common, builder: (column) => ColumnOrderings(column)); @@ -3631,6 +3665,9 @@ class $$LocalAppInstLauncherTableTableAnnotationComposer get launcherType => $composableBuilder( column: $table.launcherType, builder: (column) => column); + GeneratedColumn get favorite => + $composableBuilder(column: $table.favorite, builder: (column) => column); + GeneratedColumnWithTypeConverter get common => $composableBuilder( column: $table.common, builder: (column) => column); @@ -3675,6 +3712,7 @@ class $$LocalAppInstLauncherTableTableTableManager extends RootTableManager< Value uuid = const Value.absent(), Value appInstUUID = const Value.absent(), Value launcherType = const Value.absent(), + Value favorite = const Value.absent(), Value common = const Value.absent(), Value steam = const Value.absent(), }) => @@ -3683,6 +3721,7 @@ class $$LocalAppInstLauncherTableTableTableManager extends RootTableManager< uuid: uuid, appInstUUID: appInstUUID, launcherType: launcherType, + favorite: favorite, common: common, steam: steam, ), @@ -3691,6 +3730,7 @@ class $$LocalAppInstLauncherTableTableTableManager extends RootTableManager< required String uuid, required String appInstUUID, required LocalAppInstLauncherType launcherType, + Value favorite = const Value.absent(), Value common = const Value.absent(), Value steam = const Value.absent(), }) => @@ -3699,6 +3739,7 @@ class $$LocalAppInstLauncherTableTableTableManager extends RootTableManager< uuid: uuid, appInstUUID: appInstUUID, launcherType: launcherType, + favorite: favorite, common: common, steam: steam, ), diff --git a/packages/dao/lib/src/gebura_dao.dart b/packages/dao/lib/src/gebura_dao.dart index 74e0004..6f44d34 100644 --- a/packages/dao/lib/src/gebura_dao.dart +++ b/packages/dao/lib/src/gebura_dao.dart @@ -159,6 +159,7 @@ class GeburaDao extends DatabaseAccessor with _$GeburaDaoMixin { uuid: Value(data.uuid), appInstUUID: Value(data.appInstUUID), launcherType: Value(data.launcherType), + favorite: Value(data.favorite), common: Value(data.common), steam: Value(data.steam), )); @@ -190,6 +191,7 @@ class GeburaDao extends DatabaseAccessor with _$GeburaDaoMixin { uuid: Value(data.uuid), appInstUUID: Value(data.appInstUUID), launcherType: Value(data.launcherType), + favorite: Value(data.favorite), common: Value(data.common), steam: Value(data.steam), )); diff --git a/packages/dao/lib/src/tables/local_app_inst_launcher.dart b/packages/dao/lib/src/tables/local_app_inst_launcher.dart index 7cca996..387c0ee 100644 --- a/packages/dao/lib/src/tables/local_app_inst_launcher.dart +++ b/packages/dao/lib/src/tables/local_app_inst_launcher.dart @@ -8,6 +8,7 @@ class LocalAppInstLauncher with LocalAppInstLauncherMappable { final String uuid; final String appInstUUID; final LocalAppInstLauncherType launcherType; + final bool? favorite; final LocalAppInstLaunchCommon? common; final LocalAppInstLaunchSteam? steam; @@ -15,6 +16,7 @@ class LocalAppInstLauncher with LocalAppInstLauncherMappable { required this.uuid, required this.appInstUUID, required this.launcherType, + this.favorite, this.common, this.steam, }); @@ -107,6 +109,7 @@ class LocalAppInstLauncherTable extends Table { TextColumn get uuid => text().unique()(); TextColumn get appInstUUID => text()(); IntColumn get launcherType => intEnum()(); + BoolColumn get favorite => boolean().nullable()(); TextColumn get common => text().nullable().map(const LocalAppInstLaunchCommonConverter())(); TextColumn get steam => diff --git a/packages/dao/lib/src/tables/local_app_inst_launcher.mapper.dart b/packages/dao/lib/src/tables/local_app_inst_launcher.mapper.dart index 45a3fe8..f15d686 100644 --- a/packages/dao/lib/src/tables/local_app_inst_launcher.mapper.dart +++ b/packages/dao/lib/src/tables/local_app_inst_launcher.mapper.dart @@ -32,6 +32,9 @@ class LocalAppInstLauncherMapper extends ClassMapperBase { v.launcherType; static const Field _f$launcherType = Field('launcherType', _$launcherType); + static bool? _$favorite(LocalAppInstLauncher v) => v.favorite; + static const Field _f$favorite = + Field('favorite', _$favorite, opt: true); static LocalAppInstLaunchCommon? _$common(LocalAppInstLauncher v) => v.common; static const Field _f$common = Field('common', _$common, opt: true); @@ -44,6 +47,7 @@ class LocalAppInstLauncherMapper extends ClassMapperBase { #uuid: _f$uuid, #appInstUUID: _f$appInstUUID, #launcherType: _f$launcherType, + #favorite: _f$favorite, #common: _f$common, #steam: _f$steam, }; @@ -53,6 +57,7 @@ class LocalAppInstLauncherMapper extends ClassMapperBase { uuid: data.dec(_f$uuid), appInstUUID: data.dec(_f$appInstUUID), launcherType: data.dec(_f$launcherType), + favorite: data.dec(_f$favorite), common: data.dec(_f$common), steam: data.dec(_f$steam)); } @@ -122,6 +127,7 @@ abstract class LocalAppInstLauncherCopyWith< {String? uuid, String? appInstUUID, LocalAppInstLauncherType? launcherType, + bool? favorite, LocalAppInstLaunchCommon? common, LocalAppInstLaunchSteam? steam}); LocalAppInstLauncherCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>( @@ -149,12 +155,14 @@ class _LocalAppInstLauncherCopyWithImpl<$R, $Out> {String? uuid, String? appInstUUID, LocalAppInstLauncherType? launcherType, + Object? favorite = $none, Object? common = $none, Object? steam = $none}) => $apply(FieldCopyWithData({ if (uuid != null) #uuid: uuid, if (appInstUUID != null) #appInstUUID: appInstUUID, if (launcherType != null) #launcherType: launcherType, + if (favorite != $none) #favorite: favorite, if (common != $none) #common: common, if (steam != $none) #steam: steam })); @@ -163,6 +171,7 @@ class _LocalAppInstLauncherCopyWithImpl<$R, $Out> uuid: data.get(#uuid, or: $value.uuid), appInstUUID: data.get(#appInstUUID, or: $value.appInstUUID), launcherType: data.get(#launcherType, or: $value.launcherType), + favorite: data.get(#favorite, or: $value.favorite), common: data.get(#common, or: $value.common), steam: data.get(#steam, or: $value.steam));