merge-update-with-lab-changes
hussam al-habibeh 4 years ago
parent 76eef8625d
commit c56e4a1a5c

@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
class GestureIconButton extends StatefulWidget { class GestureIconButton extends StatefulWidget {
GestureIconButton( GestureIconButton(
this.label, this.label,
this.icon, { this.icon, {
Key key, Key key,
this.onTap, this.onTap,
this.backgroundColor, this.backgroundColor,
}) : super(key: key); }) : super(key: key);
final String label; final String label;
final Widget icon; final Widget icon;
@ -29,41 +29,35 @@ class _GestureIconButtonState extends State<GestureIconButton> {
setState(() => _buttonLongPress = !_buttonLongPress), setState(() => _buttonLongPress = !_buttonLongPress),
onLongPressEnd: (_) => onLongPressEnd: (_) =>
setState(() => _buttonLongPress = !_buttonLongPress), setState(() => _buttonLongPress = !_buttonLongPress),
child: Wrap( child: Container(
children: [ decoration: BoxDecoration(
Container( border: Border.all(
decoration: BoxDecoration( color: widget.backgroundColor != null
border: Border.all( ? widget.backgroundColor
color: widget.backgroundColor != null : Colors.grey[200],
? 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 Texts(
? widget.backgroundColor widget.label,
: Colors.grey.shade200, color: _buttonLongPress ? Colors.white : Colors.black,
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,
),
],
),
), ),
), ],
), ),
), ),
], ),
), ),
); );
} }

Loading…
Cancel
Save