* Screen
* active_button.dart
class ActiveButton extends StatefulWidget {
final EdgeInsets padding;
final dynamic onPressed;
final String title;
bool isActive;
final Color activeColor;
final Color inativeColor;
ActiveButton({
Key? key,
this.padding = const EdgeInsets.symmetric(
vertical: 15, horizontal: 20),
required this.onPressed,
this.title = 'ActiveButton',
this.isActive = true,
this.activeColor = Colors.black,
this.inativeColor = const Color(0xFFCCCCCC),
}) : super(key: key);
@override
_ActiveButtonState createState() => _ActiveButtonState();
}
class _ActiveButtonState extends State<ActiveButton> {
@override
Widget build(BuildContext context) {
return Padding(
padding: widget.padding,
child: OutlinedButton(
onPressed: widget.onPressed,
style: OutlinedButton.styleFrom(
side: BorderSide(
color:
widget.isActive ? widget.activeColor : widget.inativeColor),
shape: RoundedRectangleBorder(
borderRadius: RadiusConfig.shallow,
),
primary: widget.isActive ? widget.inativeColor : widget.activeColor,
backgroundColor:
widget.isActive ? widget.activeColor : widget.inativeColor,
),
child: Container(
alignment: Alignment.center,
height: 50,
child: Text('${widget.title}',
style: TextStyle(
fontWeight: NotoSansKR.kBold, color: ColorConfig.white)),
),
),
);
}
}
* example
ActiveButton(
onPressed: () {},
title: '확인',
),
'App > Flutter' 카테고리의 다른 글
[ FLUTTER 커스텀 ] AppBar (0) | 2021.12.13 |
---|---|
[ FLUTTER 커스텀 ] SliverAppBar (0) | 2021.12.13 |
[ FLUTTER ] WebView Package 지도 표시 (0) | 2021.11.26 |
[ FLUTTER ] 키보드가 위젯을 가리는 문제 해결방법 (0) | 2021.10.22 |
[ FLUTTER ] 앱 종료 (0) | 2021.10.13 |