Skip to content

Commit

Permalink
fix: add semantics to widget
Browse files Browse the repository at this point in the history
  • Loading branch information
sonle-geekyants committed May 13, 2022
1 parent 2948525 commit 16a88f6
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 198 deletions.
81 changes: 44 additions & 37 deletions lib/screens/common_widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,44 +208,51 @@ class _CustomAppBarState extends State<CustomAppBar> {
}

Widget menuBar(BuildContext context) {
return GestureDetector(
onTap: () {
Scaffold.of(context).openEndDrawer();
},
child: Stack(
alignment: Alignment.topRight,
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsets.only(top: 10.toHeight),
height: 22.toHeight,
width: 22.toWidth,
child: Image.asset(
ImageConstants.drawerIcon,
),
),
Consumer<FileDownloadChecker>(
builder: (context, _fileDownloadChecker, _) {
return _fileDownloadChecker.undownloadedFilesExist
? Positioned(
right: -4,
top: 2,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
padding: EdgeInsets.all(1.toHeight),
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 5.toWidth,
return Consumer<FileDownloadChecker>(
builder: (context, _fileDownloadChecker, _) {
return IconButton(
onPressed: () {
Scaffold.of(context).openEndDrawer();
},
alignment: Alignment.topCenter,
tooltip: _fileDownloadChecker.undownloadedFilesExist
? 'Hamburger Menu & Dot'
: 'Hamburger Menu',
padding: EdgeInsets.zero,
icon: Stack(
alignment: Alignment.topRight,
clipBehavior: Clip.none,
children: [
Container(
margin: EdgeInsets.only(top: 10.toHeight),
height: 22.toHeight,
width: 22.toWidth,
child: Image.asset(
ImageConstants.drawerIcon,
semanticLabel: '',
),
),
_fileDownloadChecker.undownloadedFilesExist
? Positioned(
right: -4,
top: 2,
child: Container(
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
),
padding: EdgeInsets.all(1.toHeight),
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 5.toWidth,
),
),
),
)
: SizedBox();
}),
],
),
)
: SizedBox(),
],
),
);
},
);
}
}
7 changes: 5 additions & 2 deletions lib/screens/common_widgets/common_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ class CommonButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
double deviceTextFactor = MediaQuery.of(context).textScaleFactor;
return InkWell(
onTap: onTap,
return TextButton(
onPressed: onTap,
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
),
child: Container(
width: width ?? 120.toWidth,
height: height ?? 45.toHeight * deviceTextFactor,
Expand Down
7 changes: 5 additions & 2 deletions lib/screens/common_widgets/custom_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ class CustomButton extends StatelessWidget {
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onPressed,
return TextButton(
onPressed: onPressed,
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
),
child: Container(
width: width ?? 158.toWidth,
height: height ?? (50.toHeight),
Expand Down
16 changes: 12 additions & 4 deletions lib/screens/history/widgets/received_file_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,12 @@ class _ReceivedFilesListTileState extends State<ReceivedFilesListTile> {
height: 3.toHeight,
),
(!isOpen!)
? GestureDetector(
onTap: () {
? TextButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: () {
if (mounted) {
setState(() {
isOpen = !isOpen;
Expand Down Expand Up @@ -593,8 +597,12 @@ class _ReceivedFilesListTileState extends State<ReceivedFilesListTile> {
);
}),
),
GestureDetector(
onTap: () {
TextButton(
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: () {
if (mounted) {
setState(() {
isOpen = !isOpen!;
Expand Down
17 changes: 8 additions & 9 deletions lib/screens/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ class _HomeState extends State<Home> {
children: [
Text(
TextStrings().homeDescriptionMobile,
semanticsLabel:
'${TextStrings().appName} \n ${TextStrings().homeDescriptionMobile}',
style: GoogleFonts.playfairDisplay(
textStyle: TextStyle(
fontSize: 38.toFont,
Expand Down Expand Up @@ -266,18 +268,15 @@ class _HomeState extends State<Home> {
await _backendService
.checkToOnboard();
}),
SizedBox(height: 15.toHeight),
InkWell(
onTap: () {
// SizedBox(height: 15.toHeight),
CustomButton(
onPressed: () {
CommonUtilityFunctions()
.showResetAtsignDialog();
},
child: Text(
TextStrings.resetButton,
style: TextStyle(
fontSize: 15.toFont,
fontWeight: FontWeight.bold),
),
isInverted: true,
width: SizeConfig().screenWidth * 0.8,
buttonText: TextStrings.resetButton,
),
],
),
Expand Down
48 changes: 21 additions & 27 deletions lib/screens/welcome_screen/widgets/select_contact_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class _SelectContactWidgetState extends State<SelectContactWidget> {
textTheme: TextTheme(
subtitle1: TextStyle(
color: ColorConstants.inputFieldColor,
fontWeight: FontWeight.normal,
),
),
),
Expand All @@ -62,36 +61,31 @@ class _ExpansionTileWidget extends StatelessWidget {
_ExpansionTileWidget(this.headerText, this.onSelected);
@override
Widget build(BuildContext context) {
return ExpansionTile(
tilePadding: SizeConfig().isTablet(context)
? EdgeInsets.symmetric(vertical: 10.toFont, horizontal: 10.toFont)
: EdgeInsets.only(left: 10.toFont, right: 10.toFont),
backgroundColor: ColorConstants.inputFieldColor,
title: InkWell(
onTap: () {
selectContact(context);
},
child: Text(
headerText!,
style: TextStyle(
color: ColorConstants.fadedText,
fontSize: 14.toFont,
fontWeight: FontWeight.normal,
),
return ListTile(
// tilePadding: SizeConfig().isTablet(context)
// ? EdgeInsets.symmetric(vertical: 10.toFont, horizontal: 10.toFont)
// : EdgeInsets.only(left: 10.toFont, right: 10.toFont),
// backgroundColor: ColorConstants.inputFieldColor,
title: Text(
headerText!,
style: TextStyle(
color: ColorConstants.fadedText,
fontSize: 14.toFont,
fontWeight: FontWeight.normal,
),
semanticsLabel: 'Select @sign from contacts button',
),
trailing: InkWell(
onTap: () {
selectContact(context);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 15),
child: Image.asset(
ImageConstants.contactsIcon,
color: Colors.black,
),
trailing: Container(
padding: EdgeInsets.symmetric(vertical: 15),
child: Image.asset(
ImageConstants.contactsIcon,
color: Colors.black,
semanticLabel: '',
),
),
onTap: () {
selectContact(context);
},
);
}

Expand Down
Loading

0 comments on commit 16a88f6

Please sign in to comment.