Created
August 25, 2019 21:36
-
-
Save jamesdixon/62d1b6fd3c385d39b425b3c54bb783b5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// main.dart | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return GestureDetector( | |
onTap: () { | |
FocusScopeNode currentFocus = FocusScope.of(context); | |
if (!currentFocus.hasPrimaryFocus) { | |
currentFocus.unfocus(); | |
} | |
}, | |
child: MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: MyHomePage(), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment