Skip to content

Commit 888c05e

Browse files
committed
♿ Settings checkbox and switch accessibility improved
1 parent d021e12 commit 888c05e

File tree

8 files changed

+99
-26
lines changed

8 files changed

+99
-26
lines changed

lib/page/settings/accountSettings/about/aboutTwitter.dart

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AboutPage extends StatelessWidget {
2929
),
3030
SettingRowWidget(
3131
"Help Centre",
32-
vPadding: 15,
32+
vPadding: 0,
3333
showDivider: false,
3434
onPressed: (){
3535
launchURL("https://github.com/TheAlphamerc/flutter_twitter_clone/issues");
@@ -59,7 +59,36 @@ class AboutPage extends StatelessWidget {
5959
useRootNavigator: true,
6060
);
6161
},
62-
)
62+
),
63+
HeaderWidget('Developer'),
64+
SettingRowWidget(
65+
"Github",
66+
showDivider: true,
67+
onPressed: (){
68+
launchURL("https://github.com/TheAlphamerc");
69+
}
70+
),
71+
SettingRowWidget(
72+
"LinkidIn",
73+
showDivider: true,
74+
onPressed: (){
75+
launchURL("https://www.linkedin.com/in/thealphamerc/");
76+
}
77+
),
78+
SettingRowWidget(
79+
"Twitter",
80+
showDivider: true,
81+
onPressed: (){
82+
launchURL("https://twitter.com/TheAlphaMerc");
83+
}
84+
),
85+
SettingRowWidget(
86+
"Blog",
87+
showDivider: true,
88+
onPressed: (){
89+
launchURL("https://dev.to/thealphamerc");
90+
}
91+
),
6392
],
6493
),
6594
);

lib/page/settings/accountSettings/accessibility/accessibility.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class AccessibilityPage extends StatelessWidget {
129129
subtitle:
130130
'Adds the ability to describe images for the visually impaired.',
131131
vPadding: 15,
132-
showCheckBox: true,
132+
showCheckBox: false,
133133
onPressed: () {
134134
openDarkModeSettings(context);
135135
},
@@ -144,7 +144,7 @@ class AccessibilityPage extends StatelessWidget {
144144
subtitle:
145145
'Limit the amount of in-app animations, including live engagement counts.',
146146
vPadding: 15,
147-
showCheckBox: true,
147+
showCheckBox: false,
148148
onPressed: () {
149149
openDarkModeSettings(context);
150150
},

lib/page/settings/accountSettings/displaySettings/displayAndSoundPage.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class DisplayAndSoundPage extends StatelessWidget {
120120
HeaderWidget('Media'),
121121
SettingRowWidget(
122122
"Media Previews",
123-
showCheckBox: true,
123+
showCheckBox: false,
124124
),
125125
Divider(height: 0),
126126
HeaderWidget('Display'),
@@ -145,7 +145,7 @@ class DisplayAndSoundPage extends StatelessWidget {
145145
subtitle:
146146
'Use the Fwitter set instead of your device\'s default set',
147147
showDivider: false,
148-
showCheckBox: true,
148+
showCheckBox: false,
149149
),
150150
HeaderWidget(
151151
'Sound',
@@ -154,16 +154,16 @@ class DisplayAndSoundPage extends StatelessWidget {
154154
SettingRowWidget(
155155
"Sound effects",
156156
// vPadding: 15,
157-
showCheckBox: true,
157+
showCheckBox: false,
158158
),
159159
HeaderWidget(
160160
'Web browser',
161-
secondHeader: true,
161+
secondHeader: false,
162162
),
163163
SettingRowWidget(
164164
"Use in-app browser",
165165
subtitle: 'Open external links with Fwitter browser',
166-
showCheckBox: true,
166+
showCheckBox: false,
167167
),
168168
],
169169
),

lib/page/settings/accountSettings/notifications/notificationPage.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter_twitter_clone/page/settings/widgets/headerWidget.dart';
55
import 'package:flutter_twitter_clone/page/settings/widgets/settingsAppbar.dart';
66
import 'package:flutter_twitter_clone/page/settings/widgets/settingsRowWidget.dart';
77
import 'package:flutter_twitter_clone/state/authState.dart';
8-
import 'package:flutter_twitter_clone/widgets/newWidget/customUrlText.dart';
98
import 'package:provider/provider.dart';
109

1110
class NotificationPage extends StatelessWidget {
@@ -39,7 +38,7 @@ class NotificationPage extends StatelessWidget {
3938
),
4039
SettingRowWidget(
4140
"Unread notification count badge",
42-
showCheckBox: true,
41+
showCheckBox: false,
4342
subtitle:
4443
'Display a badge with the number of notifications waiting for you inside the Fwitter app.',
4544
),

lib/page/settings/accountSettings/privacyAndSafety/privacyAndSafetyPage.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import 'package:flutter_twitter_clone/page/settings/widgets/headerWidget.dart';
55
import 'package:flutter_twitter_clone/page/settings/widgets/settingsAppbar.dart';
66
import 'package:flutter_twitter_clone/page/settings/widgets/settingsRowWidget.dart';
77
import 'package:flutter_twitter_clone/state/authState.dart';
8-
import 'package:flutter_twitter_clone/widgets/newWidget/customUrlText.dart';
98
import 'package:provider/provider.dart';
109

1110
class PrivacyAndSaftyPage extends StatelessWidget {
@@ -107,7 +106,7 @@ class PrivacyAndSaftyPage extends StatelessWidget {
107106
SettingRowWidget(
108107
"Precise location",
109108
subtitle:
110-
'Disabled \n\n\nIf enabled, Fwitter will collect, store, and use your device\'s precise location, such as your GPS information. This lets Fwitter improve your experience - for rxample, showing you mpre local content, ads, and recommendations.',
109+
'Disabled \n\n\nIf enabled, Fwitter will collect, store, and use your device\'s precise location, such as your GPS information. This lets Fwitter improve your experience - for example, showing you mpre local content, ads, and recommendations.',
111110
),
112111
HeaderWidget(
113112
'Personalisation and data',

lib/page/settings/accountSettings/proxy/proxyPage.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ProxyPage extends StatelessWidget {
2424
children: <Widget>[
2525
SettingRowWidget(
2626
"Enable HTTP Proxy",
27-
showCheckBox: true,
27+
showCheckBox: false,
2828
vPadding: 15,
2929
showDivider: true,
3030
subtitle:

lib/page/settings/widgets/settingsRowWidget.dart

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_twitter_clone/helper/theme.dart';
3+
import 'package:flutter_twitter_clone/widgets/newWidget/customCheckBox.dart';
34
import 'package:flutter_twitter_clone/widgets/newWidget/customUrlText.dart';
5+
import 'package:provider/provider.dart';
46

57
class SettingRowWidget extends StatelessWidget {
68
const SettingRowWidget(
@@ -12,8 +14,8 @@ class SettingRowWidget extends StatelessWidget {
1214
this.onPressed,
1315
this.vPadding = 0,
1416
this.showDivider = true,
15-
this.visibleSwitch = false,
16-
this.showCheckBox = false,
17+
this.visibleSwitch ,
18+
this.showCheckBox ,
1719
}) : super(key: key);
1820
final bool visibleSwitch, showDivider, showCheckBox;
1921
final String navigateTo;
@@ -52,19 +54,12 @@ class SettingRowWidget extends StatelessWidget {
5254
style: TextStyle(
5355
color: TwitterColor.paleSky, fontWeight: FontWeight.w400),
5456
),
55-
trailing: showCheckBox
56-
? !showCheckBox
57-
? SizedBox()
58-
: Checkbox(value: true, onChanged: (val) {})
59-
: !visibleSwitch
60-
? null
61-
: Switch(
62-
onChanged: (val) {},
63-
value: false,
64-
),
57+
trailing: CustomCheckBox(isChecked:showCheckBox,visibleSwitch: visibleSwitch, )
58+
6559
),
6660
!showDivider ? SizedBox() : Divider(height: 0)
6761
],
6862
);
6963
}
7064
}
65+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'package:flutter/material.dart';
2+
3+
class CustomCheckBox extends StatefulWidget {
4+
final bool isChecked;
5+
final bool visibleSwitch;
6+
CustomCheckBox({Key key, this.isChecked, this.visibleSwitch})
7+
: super(key: key);
8+
9+
@override
10+
_CustomCheckBoxState createState() => _CustomCheckBoxState();
11+
}
12+
13+
class _CustomCheckBoxState extends State<CustomCheckBox> {
14+
ValueNotifier<bool> isChecked = ValueNotifier(false);
15+
ValueNotifier<bool> visibleSwitch = ValueNotifier(false);
16+
@override
17+
void initState() {
18+
isChecked.value = widget.isChecked ;
19+
visibleSwitch.value = widget.visibleSwitch;
20+
super.initState();
21+
}
22+
23+
@override
24+
Widget build(BuildContext context) {
25+
return widget.isChecked != null
26+
? ValueListenableBuilder<bool>(
27+
valueListenable: isChecked,
28+
builder: (context, value, child) {
29+
return Checkbox(
30+
value: value,
31+
onChanged: (val) {
32+
isChecked.value = val;
33+
},
34+
);
35+
},
36+
)
37+
: widget.visibleSwitch == null
38+
? SizedBox(height: 10, width:10,)
39+
: ValueListenableBuilder(
40+
valueListenable: visibleSwitch,
41+
builder: (context, value, child) {
42+
return Switch(
43+
onChanged: (val) {
44+
visibleSwitch.value = val;
45+
},
46+
value: value,
47+
);
48+
},
49+
);
50+
}
51+
}

0 commit comments

Comments
 (0)