fix(ui-kit): fix accessibility text size scaling in message widget

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-03-31 12:50:41 +05:30
parent 420d6384c4
commit fec7cfa572
4 changed files with 15 additions and 13 deletions
@@ -97,3 +97,8 @@ extension InputDecorationX on InputDecoration {
); );
} }
} }
extension BuildContextX on BuildContext {
double get textScaleFactor =>
MediaQuery.maybeOf(this)?.textScaleFactor ?? 1.0;
}
@@ -262,15 +262,13 @@ class _MessageSearchListViewState extends State<MessageSearchListView> {
); );
if (widget.pullToRefresh) { if (widget.pullToRefresh) {
child = RefreshIndicator( child = RefreshIndicator(
onRefresh: () => _messageSearchListController.loadData(), onRefresh: _messageSearchListController.loadData,
child: child, child: child,
); );
} }
child = LazyLoadScrollView( child = LazyLoadScrollView(
onEndOfPage: () async { onEndOfPage: _messageSearchListController.paginateData,
return _messageSearchListController.paginateData();
},
child: child, child: child,
); );
@@ -585,7 +585,10 @@ class _MessageWidgetState extends State<MessageWidget>
), ),
], ],
), ),
if (showBottomRow) SizedBox(height: 20.0), if (showBottomRow)
SizedBox(
height: context.textScaleFactor * 20.0,
),
], ],
), ),
if (showBottomRow) if (showBottomRow)
@@ -733,7 +736,7 @@ class _MessageWidgetState extends State<MessageWidget>
transform: Matrix4.rotationY(widget.reverse ? pi : 0), transform: Matrix4.rotationY(widget.reverse ? pi : 0),
alignment: Alignment.center, alignment: Alignment.center,
child: Container( child: Container(
height: 16, height: context.textScaleFactor * 16,
child: Center( child: Center(
child: child, child: child,
), ),
@@ -193,7 +193,7 @@ class _UserListViewState extends State<UserListView>
return child; return child;
} else { } else {
return RefreshIndicator( return RefreshIndicator(
onRefresh: () => _userListController.loadData(), onRefresh: _userListController.loadData,
child: child, child: child,
); );
} }
@@ -241,9 +241,7 @@ class _UserListViewState extends State<UserListView>
child: Text(message), child: Text(message),
), ),
TextButton( TextButton(
onPressed: () { onPressed: () => _userListController.loadData(),
_userListController.loadData();
},
child: Text('Retry'), child: Text('Retry'),
), ),
], ],
@@ -298,9 +296,7 @@ class _UserListViewState extends State<UserListView>
); );
return LazyLoadScrollView( return LazyLoadScrollView(
onEndOfPage: () async { onEndOfPage: _userListController.paginateData,
return _userListController.paginateData();
},
child: child, child: child,
); );
} }