fluffychat/lib/pangea/widgets/space/language_level_dropdown.dart
ggurdin 9ecf4e3bd2
fix: fix dart formatting for CI (#1368)
* fix: fix dart formatting for CI

* fix: sorted imports, updated deprecated flutter functions

* fix: format files

* fix: format files

* feat: replace syncfusion flutter package with excel flutter package

* fix: don't run enable google services patch in CI

* fix: update iOS supported platforms for enable ios build script

* fix: commented out linux build in integrate CI
2025-01-07 08:32:42 -05:00

49 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:fluffychat/pangea/constants/language_constants.dart';
import 'package:fluffychat/pangea/utils/language_level_copy.dart';
class LanguageLevelDropdown extends StatelessWidget {
final int? initialLevel;
final void Function(int?)? onChanged;
final String? Function(int?)? validator;
final bool enabled;
const LanguageLevelDropdown({
super.key,
this.initialLevel,
this.onChanged,
this.validator,
this.enabled = true,
});
@override
Widget build(BuildContext context) {
return DropdownButtonFormField2(
hint: Text(
L10n.of(context).selectLanguageLevel,
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
),
value: initialLevel,
items: LanguageLevelType.allInts.map((int levelOption) {
return DropdownMenuItem(
value: levelOption,
child: Text(
LanguageLevelTextPicker.languageLevelText(
context,
levelOption,
),
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
),
);
}).toList(),
onChanged: enabled ? onChanged : null,
validator: validator,
);
}
}