Created
June 1, 2021 21:34
-
-
Save Merrit/510e3c43a0368324c09dc8d96f802346 to your computer and use it in GitHub Desktop.
Focus traversal testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark(), | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: SizedBox( | |
width: double.infinity, | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
children: [ | |
for (var i = 0; i < 2; i++) | |
FocusableActionDetector( | |
onFocusChange: (focused) { | |
if (!focused) { | |
print('Have left focus group'); | |
} | |
}, | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
for (var i = 0; i < 3; i++) | |
SizedBox( | |
width: 150, | |
child: TextField(), | |
), | |
], | |
), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment