Skip to content

Instantly share code, notes, and snippets.

@ArcticZeroo
Created August 1, 2020 19:50
Show Gist options
  • Save ArcticZeroo/e7a5370413350609ab4e00d78711f820 to your computer and use it in GitHub Desktop.
Save ArcticZeroo/e7a5370413350609ab4e00d78711f820 to your computer and use it in GitHub Desktop.
Flutter IconButton Splash 2
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: Row(
children: [
IconButton(
icon: Icon(Icons.remove),
onPressed: enablePress ? () { setState(() { enablePress = false; }); } : null
),
SizedBox(
width: 24
),
IconButton(
icon: Icon(Icons.add),
onPressed: enablePress ? null : () { setState(() { enablePress = true; }); }
)
]
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment