mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Created UI for Langauge Switching
This commit is contained in:
parent
8e14f8b9f1
commit
214946cbbc
@ -1,10 +1,53 @@
|
|||||||
|
import 'package:app_flowy/workspace/application/appearance.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flowy_infra/language.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
|
||||||
class SettingsLanguageView extends StatelessWidget {
|
class SettingsLanguageView extends StatelessWidget {
|
||||||
const SettingsLanguageView({Key? key}) : super(key: key);
|
const SettingsLanguageView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Center(child: Text('Work In Progress'));
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: const [
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
LanguageSelectorDropdown()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LanguageSelectorDropdown extends StatefulWidget {
|
||||||
|
const LanguageSelectorDropdown({
|
||||||
|
Key? key,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LanguageSelectorDropdown> createState() => _LanguageSelectorDropdownState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LanguageSelectorDropdownState extends State<LanguageSelectorDropdown> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return DropdownButton<AppLanguage>(
|
||||||
|
value: context.read<AppearanceSettingModel>().language,
|
||||||
|
onChanged: (val) {
|
||||||
|
setState(() {
|
||||||
|
context.read<AppearanceSettingModel>().setLanguage(val!);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: AppLanguage.values.map((language) {
|
||||||
|
return DropdownMenuItem<AppLanguage>(
|
||||||
|
value: language,
|
||||||
|
child: Text(describeEnum(language)),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user