settings_dialog.dart 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import 'package:app_flowy/workspace/presentation/settings/widgets/settings_appearance_view.dart';
  2. import 'package:app_flowy/workspace/presentation/settings/widgets/settings_language_view.dart';
  3. import 'package:app_flowy/workspace/presentation/settings/widgets/settings_menu.dart';
  4. import 'package:flutter/material.dart';
  5. class SettingsDialog extends StatefulWidget {
  6. const SettingsDialog({Key? key}) : super(key: key);
  7. @override
  8. State<SettingsDialog> createState() => _SettingsDialogState();
  9. }
  10. class _SettingsDialogState extends State<SettingsDialog> {
  11. int _selectedViewIndex = 0;
  12. final List<Widget> settingsViews = const [
  13. SettingsAppearanceView(),
  14. SettingsLanguageView(),
  15. ];
  16. @override
  17. Widget build(BuildContext context) {
  18. return AlertDialog(
  19. shape: RoundedRectangleBorder(
  20. borderRadius: BorderRadius.circular(10),
  21. ),
  22. title: const Text(
  23. 'Settings',
  24. style: TextStyle(
  25. fontWeight: FontWeight.bold,
  26. ),
  27. ),
  28. content: ConstrainedBox(
  29. constraints: const BoxConstraints(
  30. maxHeight: 600,
  31. ),
  32. child: Row(
  33. crossAxisAlignment: CrossAxisAlignment.start,
  34. children: [
  35. Expanded(
  36. flex: 1,
  37. child: SettingsMenu(
  38. changeSelectedIndex: (index) {
  39. setState(() {
  40. _selectedViewIndex = index;
  41. });
  42. },
  43. currentIndex: _selectedViewIndex,
  44. ),
  45. ),
  46. const VerticalDivider(),
  47. const SizedBox(width: 10),
  48. Expanded(
  49. flex: 4,
  50. child: settingsViews[_selectedViewIndex],
  51. )
  52. ],
  53. ),
  54. ),
  55. );
  56. }
  57. }