diff --git a/lib/app/modules/faker/accounts.dart b/lib/app/modules/faker/accounts.dart index c1555a494..80ed9f05f 100644 --- a/lib/app/modules/faker/accounts.dart +++ b/lib/app/modules/faker/accounts.dart @@ -121,13 +121,7 @@ class _FakerAccountsPageState extends State { } Widget itemBuilder(BuildContext context, AutoLoginData user) { - Widget child; - switch (user) { - case AutoLoginDataJP(): - child = buildJP(context, user); - case AutoLoginDataCN(): - child = buildCN(context, user); - } + Widget child = buildOne(context: context, user: user); if (!sorting) { child = Row( @@ -161,47 +155,40 @@ class _FakerAccountsPageState extends State { return child; } - Widget buildJP(BuildContext context, AutoLoginDataJP user) { + Widget buildOne({required BuildContext context, required AutoLoginData user}) { return ListTile( dense: true, key: ObjectKey(user), - title: Text('[${user.region.upper}] ${user.userGame?.name}'), - subtitle: Text(user.userGame?.friendCode ?? user.auth?.userId.toString() ?? 'null'), + title: Text('[${user.serverName}] ${user.userGame?.name}'), + subtitle: Text(user.userGame?.friendCode ?? 'null'), trailing: sorting ? null - : IconButton( - onPressed: () async { - await router.pushPage(FakerAccountEditPage(user: user)); - if (mounted) setState(() {}); - }, - icon: const Icon(Icons.edit), - iconSize: 20, + : Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + TimerUpdate( + duration: Duration(seconds: 60), + builder: (context, _) => user.userGame == null + ? SizedBox.shrink() + : Text( + '${user.userGame?.calCurAp()}/${user.userGame?.actMax}', + style: Theme.of(context).textTheme.bodySmall, + ), + ), + IconButton( + onPressed: () async { + await router.pushPage(FakerAccountEditPage(user: user)); + if (mounted) setState(() {}); + }, + icon: const Icon(Icons.edit), + iconSize: 20, + ), + ], ), onTap: () { router.pushPage(FakeGrandOrder(user: user)); }, ); } - - Widget buildCN(BuildContext context, AutoLoginDataCN user) { - return ListTile( - dense: true, - key: ObjectKey(user), - title: Text('[${user.region.upper}-${user.gameServer.shownName}] ${user.nickname}'), - subtitle: Text(user.userGame?.friendCode ?? "UID ${user.uid}"), - trailing: sorting - ? null - : IconButton( - onPressed: () async { - await router.pushPage(FakerAccountEditPage(user: user)); - if (mounted) setState(() {}); - }, - icon: const Icon(Icons.edit), - iconSize: 20, - ), - onTap: () async { - router.pushPage(FakeGrandOrder(user: user)); - }, - ); - } } diff --git a/lib/app/modules/faker/faker.dart b/lib/app/modules/faker/faker.dart index 0d1ffe971..36871fc47 100644 --- a/lib/app/modules/faker/faker.dart +++ b/lib/app/modules/faker/faker.dart @@ -129,34 +129,44 @@ class _FakeGrandOrderState extends State { ), body: PopScope( canPop: false, - child: Column( - children: [ - headerInfo, - // const Divider(), - Expanded( - child: ListView( - children: [ - optionSelector, - const Divider(height: 8), - battleDetailSection, - battleSetupOptionSection, - battleResultOptionSection, - battleLoopOptionSection, - uncommonSettingSection, - miscInfoSection, - notificationSettingSection, - globalSettingSection, - ], - ), - ), - const Divider(height: 1), - buttonBar, - ], + child: ListTileTheme.merge( + dense: true, + visualDensity: VisualDensity.compact, + // minVerticalPadding: 0, + // minTileHeight: 52, + child: body, ), ), ); } + Widget get body { + return Column( + children: [ + headerInfo, + // const Divider(), + Expanded( + child: ListView( + children: [ + optionSelector, + const Divider(height: 8), + battleDetailSection, + battleSetupOptionSection, + battleResultOptionSection, + battleLoopOptionSection, + uncommonSettingSection, + miscInfoSection, + notificationSettingSection, + globalSettingSection, + ], + ), + ), + const Divider(height: 1), + buttonBar, + ], + ); + } + Widget get headerInfo { List children = []; final userGame = mstData.user ?? agent.user.userGame; @@ -305,18 +315,10 @@ class _FakeGrandOrderState extends State { children.addAll([ ListTile( dense: true, - title: Text('Quest ${battleEntity.questId}/${battleEntity.questPhase}'), - subtitle: Text( + title: Text( _describeQuest(battleEntity.questId, battleEntity.questPhase, battleEntity.battleInfo?.enemyDeck.map((e) => e.svts.length).join('-')), ), - onTap: () { - router.push(url: Routes.questI(battleEntity.questId, battleEntity.questPhase)); - }, - ), - ListTile( - dense: true, - title: const Text('Drops'), subtitle: Wrap( children: [ for (final itemId in dropItems.keys.toList()..sort((a, b) => Item.compare2(a, b))) @@ -338,6 +340,10 @@ class _FakeGrandOrderState extends State { ), ], ), + trailing: Icon(DirectionalIcons.keyboard_arrow_forward(context)), + onTap: () { + router.push(url: Routes.questI(battleEntity.questId, battleEntity.questPhase)); + }, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), @@ -428,7 +434,7 @@ class _FakeGrandOrderState extends State { header: battleEntity == null ? 'Battle Details' : 'Battle ${battleEntity.id} - ${agent.curBattle == null ? "ended" : "ongoing"}' - ' (${battleEntity.createdAt.sec2date().toStringShort()})', + ' (${battleEntity.createdAt.sec2date().toCustomString(year: false)})', children: children, ); } @@ -548,14 +554,14 @@ class _FakeGrandOrderState extends State { }, icon: const Icon(Icons.add_circle)), ), - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: battleOption.waitApRecover, title: const Text("Wait AP recover"), onChanged: (v) { runtime.lockTask(() { setState(() { - battleOption.waitApRecover = v; + battleOption.waitApRecover = v!; }); }); }, @@ -749,22 +755,20 @@ class _FakeGrandOrderState extends State { ), ListTile( dense: true, - title: Text("Formation Deck - ${battleOption.deckId}"), + title: Text("Formation Deck ${battleOption.deckId}"), subtitle: formation == null ? const Text("Unknown deck") : Text('${formation.deckNo} - ${formation.name}'), - trailing: IconButton( - onPressed: () { - runtime.lockTask(() { - router.pushPage(UserFormationDecksPage( - mstData: mstData, - onSelected: (v) { - battleOption.deckId = v.id; - if (mounted) setState(() {}); - }, - )); - }); - }, - icon: const Icon(Icons.change_circle), - ), + trailing: const Icon(Icons.change_circle), + onTap: () { + router.pushPage(UserFormationDecksPage( + mstData: mstData, + onSelected: (v) { + runtime.lockTask(() { + battleOption.deckId = v.id; + }); + if (mounted) setState(() {}); + }, + )); + }, ), if (formation != null) ...[ Padding( @@ -932,7 +936,7 @@ class _FakeGrandOrderState extends State { ), ), const Divider(), - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: battleOption.useCampaignItem, secondary: Item.iconBuilder(context: context, item: null, itemId: 94065901, jumpToDetail: false), @@ -949,19 +953,19 @@ class _FakeGrandOrderState extends State { onChanged: (v) { runtime.lockTask(() { setState(() { - battleOption.useCampaignItem = v; + battleOption.useCampaignItem = v!; }); }); }, ), - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: battleOption.isApHalf, title: const Text("During AP Half Event"), onChanged: (v) { runtime.lockTask(() { setState(() { - battleOption.isApHalf = v; + battleOption.isApHalf = v!; }); }); }, @@ -1075,27 +1079,27 @@ class _FakeGrandOrderState extends State { return TileGroup( header: 'Other Options', children: [ - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: battleOption.stopIfBondLimit, title: const Text("Stop if Bond Limit"), onChanged: (v) { runtime.lockTask(() { setState(() { - battleOption.stopIfBondLimit = v; + battleOption.stopIfBondLimit = v!; }); }); }, controlAffinity: ListTileControlAffinity.trailing, ), - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: battleOption.supportCeMaxLimitBreak, title: Text('${S.current.support_servant} - ${S.current.craft_essence_short} ${S.current.max_limit_break}'), onChanged: (v) { runtime.lockTask(() { setState(() { - battleOption.supportCeMaxLimitBreak = v; + battleOption.supportCeMaxLimitBreak = v!; }); }); }, @@ -1116,14 +1120,14 @@ class _FakeGrandOrderState extends State { }, controlAffinity: ListTileControlAffinity.trailing, ), - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: battleOption.enfoceRefreshSupport, title: const Text("Force Refresh Support"), onChanged: (v) { runtime.lockTask(() { setState(() { - battleOption.enfoceRefreshSupport = v; + battleOption.enfoceRefreshSupport = v!; }); }); }, @@ -1277,13 +1281,13 @@ class _FakeGrandOrderState extends State { child: Text(fakerSettings.maxFollowerListRetryCount.toString())), ), const Divider(), - SwitchListTile.adaptive( + CheckboxListTile.adaptive( dense: true, value: fakerSettings.dumpResponse, title: const Text('Dump Responses'), onChanged: (v) { setState(() { - fakerSettings.dumpResponse = v; + fakerSettings.dumpResponse = v!; }); }, ), @@ -1428,7 +1432,7 @@ class _FakeGrandOrderState extends State { title: 'Start Looping Battle', keyboardType: TextInputType.number, autofocus: battleOption.loopCount <= 0, - text: battleOption.loopCount.toString(), + text: (battleOption.loopCount == 0 ? 1 : battleOption.loopCount).toString(), validate: (s) => (int.tryParse(s) ?? -1) > 0, onSubmit: (s) { battleOption.loopCount = int.parse(s); diff --git a/lib/app/modules/faker/history.dart b/lib/app/modules/faker/history.dart index 2d04187ae..ccba9c247 100644 --- a/lib/app/modules/faker/history.dart +++ b/lib/app/modules/faker/history.dart @@ -27,6 +27,12 @@ class _FakerHistoryViewerState extends State { appBar: AppBar( title: Text("History (${history.length})"), actions: [ + IconButton( + onPressed: () { + setState(() {}); + }, + icon: Icon(Icons.replay), + ), IconButton( onPressed: () { final history = agent.network.history; @@ -124,6 +130,12 @@ class _FakerHistoryViewerState extends State { Map? data; if (detail.isSuccess()) { data = detail.success; + if (detail.nid == 'gamedata' && data != null) { + data = { + for (final (k, v) in data.items) + k: const {'webview', 'assetbundle', 'master', 'assetbundleKey'}.contains(k) && v != '' ? '...' : v + }; + } if (data?.isNotEmpty != true && detail.fail?.isNotEmpty == true) { data = detail.fail; }