12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import 'package:eitc_erm_dental_flutter/exts.dart';
- import 'package:flutter/material.dart';
- ///主要按钮
- class MainButton extends StatelessWidget {
- final void Function() onPressed;
- final String text;
- final bool isOutlined;
- final EdgeInsets? buttonPadding;
- const MainButton(
- {super.key,
- required this.text,
- required this.onPressed,
- this.buttonPadding,
- this.isOutlined = false});
- @override
- Widget build(BuildContext context) {
- return isOutlined
- ? OutlinedButton(
- onPressed: onPressed,
- style: ButtonStyle(
- padding: buttonPadding == null
- ? null
- : WidgetStatePropertyAll(buttonPadding),
- side: WidgetStatePropertyAll(
- BorderSide(color: Color(0xFFD2D2D2)))),
- child: Text(
- text,
- style: TextStyle(color: context.onSurfaceColor),
- ))
- : ElevatedButton(
- onPressed: onPressed,
- style: ButtonStyle(
- padding: buttonPadding == null
- ? null
- : WidgetStatePropertyAll(buttonPadding),
- backgroundColor: WidgetStatePropertyAll(context.primaryColor),
- elevation: const WidgetStatePropertyAll(0.0)),
- child: Text(
- text,
- textAlign: TextAlign.center,
- style: TextStyle(
- color: context.onPrimaryColor, fontWeight: FontWeight.bold),
- ));
- }
- }
|