|
| 1 | +import 'package:flutter/material.dart'; |
| 2 | +import 'package:flutter_twitter_clone/helper/theme.dart'; |
| 3 | +import 'package:flutter_twitter_clone/page/settings/widgets/headerWidget.dart'; |
| 4 | +import 'package:flutter_twitter_clone/page/settings/widgets/settingsRowWidget.dart'; |
| 5 | +import 'package:flutter_twitter_clone/widgets/customAppBar.dart'; |
| 6 | +import 'package:flutter_twitter_clone/widgets/customWidgets.dart'; |
| 7 | +import 'package:flutter_twitter_clone/widgets/newWidget/title_text.dart'; |
| 8 | + |
| 9 | +class AccessibilityPage extends StatelessWidget { |
| 10 | + const AccessibilityPage({Key key}) : super(key: key); |
| 11 | + |
| 12 | + void openBottomSheet( |
| 13 | + BuildContext context, |
| 14 | + double height, |
| 15 | + Widget child, |
| 16 | + ) async { |
| 17 | + await showModalBottomSheet( |
| 18 | + backgroundColor: Colors.transparent, |
| 19 | + context: context, |
| 20 | + builder: (context) { |
| 21 | + return Container( |
| 22 | + height: height, |
| 23 | + decoration: BoxDecoration( |
| 24 | + color: TwitterColor.white, |
| 25 | + borderRadius: BorderRadius.only( |
| 26 | + topLeft: Radius.circular(15), |
| 27 | + topRight: Radius.circular(15), |
| 28 | + ), |
| 29 | + ), |
| 30 | + child: child, |
| 31 | + ); |
| 32 | + }, |
| 33 | + ); |
| 34 | + } |
| 35 | + |
| 36 | + void openDarkModeSettings(BuildContext context) { |
| 37 | + openBottomSheet( |
| 38 | + context, |
| 39 | + 250, |
| 40 | + Column( |
| 41 | + children: <Widget>[ |
| 42 | + SizedBox(height: 5), |
| 43 | + Container( |
| 44 | + width: 40, |
| 45 | + height: 5, |
| 46 | + decoration: BoxDecoration( |
| 47 | + color: TwitterColor.paleSky50, |
| 48 | + borderRadius: BorderRadius.circular(10), |
| 49 | + ), |
| 50 | + ), |
| 51 | + Padding( |
| 52 | + padding: EdgeInsets.symmetric(vertical: 15), |
| 53 | + child: TitleText('Data preference'), |
| 54 | + ), |
| 55 | + Divider(height: 0), |
| 56 | + _row("Mobile data & Wi-Fi"), |
| 57 | + Divider(height: 0), |
| 58 | + _row("Wi-Fi only"), |
| 59 | + Divider(height: 0), |
| 60 | + _row("Never"), |
| 61 | + ], |
| 62 | + ), |
| 63 | + ); |
| 64 | + } |
| 65 | + |
| 66 | + void openDarkModeAppearanceSettings(BuildContext context) { |
| 67 | + openBottomSheet( |
| 68 | + context, |
| 69 | + 190, |
| 70 | + Column( |
| 71 | + children: <Widget>[ |
| 72 | + SizedBox(height: 5), |
| 73 | + Container( |
| 74 | + width: 40, |
| 75 | + height: 5, |
| 76 | + decoration: BoxDecoration( |
| 77 | + color: TwitterColor.paleSky50, |
| 78 | + borderRadius: BorderRadius.circular(10), |
| 79 | + ), |
| 80 | + ), |
| 81 | + Padding( |
| 82 | + padding: EdgeInsets.symmetric(vertical: 10), |
| 83 | + child: TitleText('Dark mode appearance'), |
| 84 | + ), |
| 85 | + Divider(height: 0), |
| 86 | + _row("Dim"), |
| 87 | + Divider(height: 0), |
| 88 | + _row("Light out"), |
| 89 | + ], |
| 90 | + ), |
| 91 | + ); |
| 92 | + } |
| 93 | + |
| 94 | + Widget _row(String text) { |
| 95 | + return Padding( |
| 96 | + padding: EdgeInsets.symmetric(vertical: 0, horizontal: 5), |
| 97 | + child: RadioListTile( |
| 98 | + value: false, |
| 99 | + groupValue: true, |
| 100 | + onChanged: (val) {}, |
| 101 | + title: Text(text), |
| 102 | + controlAffinity: ListTileControlAffinity.trailing, |
| 103 | + ), |
| 104 | + ); |
| 105 | + } |
| 106 | + |
| 107 | + @override |
| 108 | + Widget build(BuildContext context) { |
| 109 | + return Scaffold( |
| 110 | + backgroundColor: TwitterColor.white, |
| 111 | + appBar: CustomAppBar( |
| 112 | + isBackButton: true, |
| 113 | + title: customTitleText( |
| 114 | + 'Accessibility', |
| 115 | + ), |
| 116 | + ), |
| 117 | + body: ListView( |
| 118 | + physics: BouncingScrollPhysics(), |
| 119 | + children: <Widget>[ |
| 120 | + HeaderWidget('Screen Reader'), |
| 121 | + SettingRowWidget( |
| 122 | + "Pronounce # as \"hashtag\"", |
| 123 | + showCheckBox: true, |
| 124 | + ), |
| 125 | + Divider(height: 0), |
| 126 | + HeaderWidget('Vision'), |
| 127 | + SettingRowWidget( |
| 128 | + "Compose image descriptions", |
| 129 | + subtitle: |
| 130 | + 'Adds the ability to describe images for the visually impaired.', |
| 131 | + vPadding: 15, |
| 132 | + showCheckBox: true, |
| 133 | + onPressed: () { |
| 134 | + openDarkModeSettings(context); |
| 135 | + }, |
| 136 | + showDivider: false, |
| 137 | + ), |
| 138 | + HeaderWidget( |
| 139 | + 'Motion', |
| 140 | + secondHeader: true, |
| 141 | + ), |
| 142 | + SettingRowWidget( |
| 143 | + "Reduce Motion", |
| 144 | + subtitle: |
| 145 | + 'Limit the amount of in-app animations, including live engagement counts.', |
| 146 | + vPadding: 15, |
| 147 | + showCheckBox: true, |
| 148 | + onPressed: () { |
| 149 | + openDarkModeSettings(context); |
| 150 | + }, |
| 151 | + ), |
| 152 | + SettingRowWidget( |
| 153 | + "Video autoplay", |
| 154 | + subtitle: 'Wi-Fi only ', |
| 155 | + onPressed: () { |
| 156 | + openDarkModeSettings(context); |
| 157 | + }, |
| 158 | + ), |
| 159 | + ], |
| 160 | + ), |
| 161 | + ); |
| 162 | + } |
| 163 | +} |
0 commit comments