Skip to content

Instantly share code, notes, and snippets.

@Turskyi
Last active July 24, 2021 10:24
Show Gist options
  • Save Turskyi/d0d8e0b66f9d7b9e0b6f4894497f9eac to your computer and use it in GitHub Desktop.
Save Turskyi/d0d8e0b66f9d7b9e0b6f4894497f9eac to your computer and use it in GitHub Desktop.
Different type of buttons
/// Button with outline
SizedBox(
height: 33,
child: new OutlineButton(
padding: AppDimens.insetsHorizontal32,
child: new Text(
translate('auth.back'),
style: Theme.of(context).textTheme.button,
),
borderSide: BorderSide(
color: Colors.black,
width: AppDimens.buttonBorder,
style: BorderStyle.solid),
onPressed: Navigator.maybeOf(context)?.pop,
textColor: Colors.black,
disabledBorderColor: Colors.black,
highlightedBorderColor: Colors.black,
shape: new RoundedRectangleBorder(
borderRadius: AppDimens.radiusBorderButton,
)),
);
***
// button with text and rounded corners
TextButton(
child: Text('···'),
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
primary: Colors.white,
backgroundColor: Color(0xFFFF9900),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(6.0),
),
),
onPressed: () {
print('Pressed');
},
);
***
// button with rounded corners and rounded popup
PopupMenuButton(
padding: EdgeInsets.zero,
iconSize: 20,
// TODO: set dynamic position according to length of the text and position in a row
//control position of the bubble
// offset: Offset(-(popupText.length.toDouble()),-52),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(6.0),
),
icon: Icon(Icons.more_horiz, color: Colors.white),
itemBuilder: (BuildContext context) {
return [
PopupMenuItem<String>(
height: 36,
textStyle: TextStyle(
color: Color(0xFF1D3866),
fontWeight: FontWeight.w700,
fontSize: 14,
fontStyle: FontStyle.normal,
fontFamily: 'Cera Round Pro',
locale: Locale(widget.locale)),
child: Text(popupText),
)
];
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment