45 lines
1.1 KiB
Dart
45 lines
1.1 KiB
Dart
import 'package:didvan/config/design_config.dart';
|
|
import 'package:didvan/models/enums.dart';
|
|
import 'package:didvan/widgets/didvan/text.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class DidvanButton extends StatelessWidget {
|
|
final VoidCallback? onPressed;
|
|
final String? title;
|
|
final ButtonStyleMode style;
|
|
const DidvanButton({
|
|
Key? key,
|
|
this.onPressed,
|
|
this.title,
|
|
this.style = ButtonStyleMode.primary,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: double.infinity,
|
|
child: MaterialButton(
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: DesignConfig.lowBorderRadius,
|
|
),
|
|
height: 48,
|
|
color: Theme.of(context).colorScheme.primary,
|
|
onPressed: () {
|
|
FocusScope.of(context).unfocus();
|
|
onPressed?.call();
|
|
},
|
|
child: _childBuilder(),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget? _childBuilder() {
|
|
if (title != null) {
|
|
return DidvanText(
|
|
title!,
|
|
color: Colors.white,
|
|
);
|
|
}
|
|
}
|
|
}
|