Skip to content

Commit 7806b3a

Browse files
committed
refactor: Use cascade notation and simplify constructors
Refactored the code in `lib/ui/game/shared.dart` to adopt a more concise style. - Replaced explicit class name references with cascade notation for static members (e.g., `ItemStack.empty` to `.empty`). - Simplified widget constructor calls by using `.new()` where applicable (e.g., `ItemStackCellTheme`). - Used cascade notation for enum values (e.g., `TextAlign.end` to `.end` and `MainAxisAlignment.spaceEvenly` to `.spaceEvenly`).
1 parent e07258f commit 7806b3a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/ui/game/shared.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,12 +601,12 @@ class ItemStackSlot with ChangeNotifier {
601601
}
602602

603603
void reset() {
604-
stack = ItemStack.empty;
604+
stack = .empty;
605605
}
606606

607607
void resetIfEmpty() {
608608
if (stack.isEmpty) {
609-
stack = ItemStack.empty;
609+
stack = .empty;
610610
}
611611
}
612612

@@ -865,7 +865,7 @@ class _BackpackSheetState extends State<BackpackSheet> {
865865
: () async {
866866
await onSelectItemStack(stack, delegate);
867867
},
868-
child: ItemStackCell(stack, theme: ItemStackCellTheme(opacity: accepted ? 1.0 : R.disabledAlpha)),
868+
child: ItemStackCell(stack, theme: .new(opacity: accepted ? 1.0 : R.disabledAlpha)),
869869
);
870870
}
871871

@@ -944,9 +944,9 @@ class _DurationStepperState extends State<DurationStepper> {
944944
Widget buildBody(Ts ts) {
945945
return [
946946
buildStepper(isLeft: true),
947-
I.ts(ts).toUpperCase().text(style: context.textTheme.headlineSmall, textAlign: TextAlign.end),
947+
I.ts(ts).toUpperCase().text(style: context.textTheme.headlineSmall, textAlign: .end),
948948
buildStepper(isLeft: false),
949-
].row(maa: MainAxisAlignment.spaceEvenly);
949+
].row(maa: .spaceEvenly);
950950
}
951951

952952
Widget buildStepper({required bool isLeft}) {

0 commit comments

Comments
 (0)