35 lines
859 B
Dart
35 lines
859 B
Dart
import 'package:didvan/config/design_config.dart';
|
|
import 'package:didvan/widgets/didvan/text.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class DidvanButton extends StatelessWidget {
|
|
final VoidCallback? onPressed;
|
|
final String? title;
|
|
const DidvanButton({Key? key, this.onPressed, this.title}) : 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).primaryColor,
|
|
onPressed: onPressed,
|
|
child: _childBuilder(),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget? _childBuilder() {
|
|
if (title != null) {
|
|
return DidvanText(
|
|
title!,
|
|
color: Colors.white,
|
|
);
|
|
}
|
|
}
|
|
}
|