Skip to content

Instantly share code, notes, and snippets.

@jamesdixon
Created August 25, 2019 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesdixon/62d1b6fd3c385d39b425b3c54bb783b5 to your computer and use it in GitHub Desktop.
Save jamesdixon/62d1b6fd3c385d39b425b3c54bb783b5 to your computer and use it in GitHub Desktop.
// 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