|
|
|
@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
class GestureIconButton extends StatefulWidget {
|
|
|
|
|
GestureIconButton(
|
|
|
|
|
this.label,
|
|
|
|
|
this.icon, {
|
|
|
|
|
Key key,
|
|
|
|
|
this.onTap,
|
|
|
|
|
this.backgroundColor,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
this.label,
|
|
|
|
|
this.icon, {
|
|
|
|
|
Key key,
|
|
|
|
|
this.onTap,
|
|
|
|
|
this.backgroundColor,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
final String label;
|
|
|
|
|
final Widget icon;
|
|
|
|
@ -29,41 +29,35 @@ class _GestureIconButtonState extends State<GestureIconButton> {
|
|
|
|
|
setState(() => _buttonLongPress = !_buttonLongPress),
|
|
|
|
|
onLongPressEnd: (_) =>
|
|
|
|
|
setState(() => _buttonLongPress = !_buttonLongPress),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: widget.backgroundColor != null
|
|
|
|
|
? widget.backgroundColor
|
|
|
|
|
: Colors.grey[200],
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: widget.backgroundColor != null
|
|
|
|
|
? widget.backgroundColor
|
|
|
|
|
: Colors.grey[200],
|
|
|
|
|
),
|
|
|
|
|
color: widget.backgroundColor != null
|
|
|
|
|
? widget.backgroundColor
|
|
|
|
|
: Colors.grey.shade200,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8))),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
|
child: widget.icon,
|
|
|
|
|
),
|
|
|
|
|
color: widget.backgroundColor != null
|
|
|
|
|
? widget.backgroundColor
|
|
|
|
|
: Colors.grey.shade200,
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8))),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Expanded(
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
|
child: widget.icon,
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
widget.label,
|
|
|
|
|
color: _buttonLongPress ? Colors.white : Colors.black,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Texts(
|
|
|
|
|
widget.label,
|
|
|
|
|
color: _buttonLongPress ? Colors.white : Colors.black,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|