Fix analyzer warnings (#12840)

This commit is contained in:
Adam Barth 2017-11-01 22:31:29 -07:00 committed by GitHub
parent c608e666ad
commit 3914214641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -300,21 +300,25 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
final GlobalKey _gestureDetectorKey = new GlobalKey(); final GlobalKey _gestureDetectorKey = new GlobalKey();
AlignmentDirectional get _drawerOuterAlignment { AlignmentDirectional get _drawerOuterAlignment {
assert(widget.alignment != null);
switch (widget.alignment) { switch (widget.alignment) {
case DrawerAlignment.start: case DrawerAlignment.start:
return AlignmentDirectional.centerStart; return AlignmentDirectional.centerStart;
case DrawerAlignment.end: case DrawerAlignment.end:
return AlignmentDirectional.centerEnd; return AlignmentDirectional.centerEnd;
} }
return null;
} }
AlignmentDirectional get _drawerInnerAlignment { AlignmentDirectional get _drawerInnerAlignment {
assert(widget.alignment != null);
switch (widget.alignment) { switch (widget.alignment) {
case DrawerAlignment.start: case DrawerAlignment.start:
return AlignmentDirectional.centerEnd; return AlignmentDirectional.centerEnd;
case DrawerAlignment.end: case DrawerAlignment.end:
return AlignmentDirectional.centerStart; return AlignmentDirectional.centerStart;
} }
return null;
} }
Widget _buildDrawer(BuildContext context) { Widget _buildDrawer(BuildContext context) {

View File

@ -630,7 +630,7 @@ void main() {
const String endDrawerLabel = 'I am the label on end side'; const String endDrawerLabel = 'I am the label on end side';
final SemanticsTester semantics = new SemanticsTester(tester); final SemanticsTester semantics = new SemanticsTester(tester);
await tester.pumpWidget(new MaterialApp(home: new Scaffold( await tester.pumpWidget(new MaterialApp(home: const Scaffold(
body: const Text(bodyLabel), body: const Text(bodyLabel),
drawer: const Drawer(child:const Text(drawerLabel)), drawer: const Drawer(child:const Text(drawerLabel)),
endDrawer: const Drawer(child:const Text(endDrawerLabel)), endDrawer: const Drawer(child:const Text(endDrawerLabel)),