settings font size visualize

This commit is contained in:
MohammadTaha Basiri 2022-03-09 18:17:36 +03:30
parent d4aca1520a
commit 87cc2ffd61
1 changed files with 10 additions and 4 deletions

View File

@ -95,10 +95,11 @@ class _GeneralSettingsState extends State<GeneralSettings> {
);
}
void _showFontFamilyBottomSheet() {
Future<void> _showFontFamilyBottomSheet() async {
final themeProvider = context.read<ThemeProvider>();
final state = context.read<GeneralSettingsState>();
ActionSheetUtils.showBottomSheet(
final family = state.fontFamily;
await ActionSheetUtils.showBottomSheet(
data: ActionSheetData(
content: StatefulBuilder(
builder: (context, setState) => Column(
@ -127,21 +128,24 @@ class _GeneralSettingsState extends State<GeneralSettings> {
),
title: 'انتخاب فونت برنامه',
titleIcon: DidvanIcons.font_regular,
onDismissed: () => state.fontFamily = family,
onConfirmed: () => themeProvider.fontFamily = state.fontFamily,
),
);
}
void _showFontScaleBottomSheet() {
Future<void> _showFontScaleBottomSheet() async {
final themeProvider = context.read<ThemeProvider>();
final state = context.read<GeneralSettingsState>();
ActionSheetUtils.showBottomSheet(
final scale = state.fontSizeScale;
await ActionSheetUtils.showBottomSheet(
data: ActionSheetData(
content: StatefulBuilder(
builder: (context, setState) => Column(
children: [
DidvanRadialButton(
title: 'بزرگ',
fontSize: 15 * 1.15,
onSelected: () {
state.fontSizeScale = 1.15;
setState(() {});
@ -160,6 +164,7 @@ class _GeneralSettingsState extends State<GeneralSettings> {
const SizedBox(height: 24),
DidvanRadialButton(
title: 'کوچک',
fontSize: 15 * 0.85,
onSelected: () {
state.fontSizeScale = 0.85;
setState(() {});
@ -171,6 +176,7 @@ class _GeneralSettingsState extends State<GeneralSettings> {
),
title: 'انتخاب اندازه متن',
titleIcon: DidvanIcons.font_regular,
onDismissed: () => state.fontSizeScale = scale,
onConfirmed: () => themeProvider.fontScale = state.fontSizeScale,
),
);