Created
August 1, 2020 19:47
-
-
Save ArcticZeroo/7fc5a4cd71fc4d5b26753356ca6df486 to your computer and use it in GitHub Desktop.
Flutter IconButton splash
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(App()); | |
} | |
class App extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) => MaterialApp( | |
theme: ThemeData.dark(), | |
home: TestWidget() | |
); | |
} | |
class TestWidget extends StatefulWidget { | |
@override | |
_TestWidgetState createState() => _TestWidgetState(); | |
} | |
class _TestWidgetState extends State<TestWidget> { | |
bool enablePress = true; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: IconButton( | |
icon: Icon(Icons.search), | |
onPressed: enablePress ? () { setState(() { enablePress = false; }); } : null | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment