v0.2.0sleek_button
一个简单但可自定义的按钮。
19喜欢 15近 30 天下载40Pub 分数
平台暂无数据
一个简单但可自定义的按钮。
^0.7.1^4.0.4^0.2.3{"sdk":"flutter"}—^0.10.4{"sdk":"flutter"}以下为英文项目原文快照,最新内容请访问 GitHub。
https://img.shields.io/pub/v/sleek_button.svg https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat
A simple but yet customizable button.
https://github.com/aloisdeniel/sleek_button/raw/master/images/examples.pngAdd the dependency to your pubspec.yaml :
dependencies:
sleek_button: <version>
SleekButton(
onTap: () {
print('tapped!');
},
style: SleekButtonStyle.flat(
color: swatch.primary,
inverted: true,
rounded: true,
size: SleekButtonSize.big,
context: context,
),
child: const Icon(Icons.format_bold),
)
SleekButton(
onTap: () {
print('tapped!');
},
style: <style>
child: const Text('Save'),,
)
SleekButton(
onTap: () {
print('tapped!');
},
style: <style>
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const Icon(Icons.check),
const SizedBox(width: 6),
const Text('Save'),
],
),
)
If the direct child is an Icon, the button will be a square.
SleekButton(
onTap: () {
print('tapped!');
},
style: <style>
child: const Icon(Icons.check),
)
SleekButtonStyle.flat(
context: context,
)
SleekButtonStyle.flat(
size: SleekButtonSize.small,
context: context,
)
SleekButtonStyle.flat(
inverted: true,
context: context,
)
SleekButtonStyle.flat(
rounded: true,
context: context,
)
SleekButtonStyle.flat(
size: SleekButtonSize.medium,
rounded: true,
context: context,
)
SleekButtonStyle.outlined(
context: context,
)
SleekButtonStyle.outlined(
size: SleekButtonSize.small,
context: context,
)
SleekButtonStyle.outlined(
inverted: true,
context: context,
)
SleekButtonStyle.outlined(
rounded: true,
context: context,
)
SleekButtonStyle.outlined(
size: SleekButtonSize.medium,
rounded: true,
context: context,
)
SleekButtonStyle.light(
context: context,
)
SleekButtonStyle.light(
size = SleekButtonSize.small,
context: context,
)
SleekButtonStyle.light(
rounded = true,
context: context,
)
SleekButtonStyle.light(
size: SleekButtonSize.medium,
rounded = true,
context: context,
)
If you give a color, all variants (dark, light, invert) will be calculated with the help of the derived_colors package.
SleekButtonStyle.flat(
color: const Color(0xFF)
context: context,
)
SleekButtonStyle.light(
color: const Color(0xFFFFC369),
context: context,
)
SleekButtonStyle.outlined(
color: const Color(0xFF323232),
context: context,
)
You can customize the default appearance of the button by adding a SleekButtonTheme in the tree. If a Theme is in the tree,
it will use it tu deduce a default theme.
SleekButtonTheme(
data: const SleekButtonThemeData(
padding: 24,
textStyle: TextStyle(fontSize: 11),
cornerRadius: 8.0,
iconTheme: IconThemeData(size: 10),
fill: Color(0xFFFF0000),
borderWidth: 2,
),
child: app,
)
Thanks to the bulma framework team for the inspiration.