added decrement function and button
parent
c54af07cc5
commit
7880da056a
|
@ -38,6 +38,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _decrementCounter() {
|
||||||
|
setState(() {
|
||||||
|
_counter--;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -59,11 +65,29 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 31),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomLeft,
|
||||||
|
child: FloatingActionButton(
|
||||||
onPressed: _incrementCounter,
|
onPressed: _incrementCounter,
|
||||||
tooltip: 'Increment',
|
tooltip: 'Increment',
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
child: FloatingActionButton(
|
||||||
|
onPressed: _decrementCounter,
|
||||||
|
tooltip: 'Decrement',
|
||||||
|
child: const Icon(Icons.remove),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue