Skip to content

Commit

Permalink
👽️ make the card size fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
H2Sxxa committed Aug 1, 2024
1 parent 64e89a0 commit f921ee5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
9 changes: 4 additions & 5 deletions lib/i18n/i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ import 'package:url_launcher/url_launcher_string.dart';
import 'package:wslconfigurer/i18n/constants.dart';
import 'package:yaml/yaml.dart';

class I18n {
@immutable
final class I18n {
late final Map<String, String> _fields;
late final Map<String, String> avaiableLanguages;
String locale = "en_US";
late final String locale;
late final LazyDynamicCan<StringTranslator<ThemeMode>> themeModeTranslator;

Map<K, V> _load<K, V>(String data) => Map.from(loadYaml(data));

FutureOr<void> init([String? locale]) async {
avaiableLanguages = _load(await rootBundle.loadString(i18nLanguages));
if (locale != null) {
this.locale = locale;
}
this.locale = locale ?? "en_US";

_fields = _load(await rootBundle.loadString(fileName("fields.yaml")));
_initLazyCans();
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class MyAppState extends State<MyApp> with RefreshMountedStateMixin {
@override
Widget build(BuildContext context) {
var configs = ArcheBus.bus.of<AppConfigs>();
var locale = configs.locale.getOr("en_US").split("_");
var locale = context.i18n.locale.split("_");
return DynamicColorBuilder(
builder: (lightDynamic, darkDynamic) => MaterialApp(
theme: ThemeData(
Expand Down
11 changes: 3 additions & 8 deletions lib/views/pages/manage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,15 @@ class _DistributionManagePageState extends State<DistributionManagePage> {
child: CircularProgressIndicator(),
);
}

return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8),
child: AnimationLimiter(
child: GridView.count(
shrinkWrap: true,
crossAxisCount: 5,
child: Wrap(
children: data.enumerate(
(index, distro) {
return AnimationConfiguration.staggeredGrid(
return AnimationConfiguration.staggeredList(
position: index,
duration: const Duration(milliseconds: 375),
columnCount: (data.length ~/ 5) + 1,
child: ScaleAnimation(
child: FadeInAnimation(
child: Card.filled(
Expand All @@ -60,7 +55,7 @@ class _DistributionManagePageState extends State<DistributionManagePage> {
current = distro;
}),
child: SizedBox.square(
dimension: 80,
dimension: 120,
child: Center(
child: Text(distro),
),
Expand Down

0 comments on commit f921ee5

Please sign in to comment.