Updated widgets
This commit is contained in:
parent
78259a6f7e
commit
5ee5902524
4 changed files with 28 additions and 45 deletions
|
|
@ -1,53 +1,33 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:ocbo_esign_validator/widgets/text_widget.dart';
|
||||
|
||||
class ButtonWidget extends StatelessWidget {
|
||||
final String text;
|
||||
final VoidCallback onPressed;
|
||||
final bool? outline;
|
||||
final VoidCallback? onPressed;
|
||||
final double? width;
|
||||
final bool disabled;
|
||||
|
||||
const ButtonWidget({super.key, required this.text, required this.onPressed, this.outline, this.width});
|
||||
const ButtonWidget({super.key, required this.text, this.onPressed, this.width, required this.disabled});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
style: outline == true
|
||||
? OutlinedButton.styleFrom(
|
||||
foregroundColor: const Color.fromRGBO(0, 0, 0, 1),
|
||||
backgroundColor: Colors.transparent,
|
||||
side: const BorderSide(color: Color.fromRGBO(198, 133, 232, 1)),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
||||
minimumSize: Size(
|
||||
MediaQuery.of(context).size.width <= 768 ? MediaQuery.of(context).size.width - 96 : 320,
|
||||
44,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
)
|
||||
: ElevatedButton.styleFrom(
|
||||
foregroundColor: const Color.fromRGBO(0, 0, 0, 1), // text color
|
||||
backgroundColor: const Color.fromRGBO(198, 133, 232, 1),
|
||||
side: const BorderSide(color: Color.fromRGBO(79, 51, 94, 0.4)), // border color
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20), // rounded corners
|
||||
),
|
||||
minimumSize: Size(
|
||||
width ?? (MediaQuery.of(context).size.width <= 768 ? MediaQuery.of(context).size.width - 96 : 320),
|
||||
44,
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: const Color.fromRGBO(250, 250, 250, 1), // text color
|
||||
backgroundColor: disabled ? const Color.fromARGB(112, 13, 109, 253) : const Color(0xff0d6efd),
|
||||
elevation: disabled ? 0 : 4,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8), // rounded corners
|
||||
),
|
||||
minimumSize: Size(
|
||||
width ?? (MediaQuery.of(context).size.width <= 768 ? MediaQuery.of(context).size.width - 96 : 320),
|
||||
44,
|
||||
),
|
||||
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: Text(text, style: _textStyle(outline)),
|
||||
child: TextWidget(text: text, size: 16),
|
||||
);
|
||||
}
|
||||
|
||||
TextStyle _textStyle(bool? outline) {
|
||||
if (outline == true) {
|
||||
return GoogleFonts.roboto(textStyle: const TextStyle(fontSize: 14, color: Color.fromRGBO(198, 133, 232, 1)));
|
||||
} else {
|
||||
return GoogleFonts.roboto(textStyle: const TextStyle(fontSize: 14, color: Color.fromRGBO(0, 0, 0, 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue