1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00
app-mirror-github/lib/theme/button.dart

53 lines
1.3 KiB
Dart
Raw Normal View History

2019-03-11 20:38:05 +00:00
import 'package:flutter/material.dart';
import 'package:vikunja_app/theme/constants.dart';
class FancyButton extends StatelessWidget {
final double width;
final double height;
2022-08-27 21:04:43 +00:00
final VoidCallback? onPressed;
2019-03-11 20:38:05 +00:00
final Widget child;
const FancyButton({
2022-08-27 21:04:43 +00:00
Key? key,
required this.child,
2019-03-11 20:38:05 +00:00
this.width = double.infinity,
this.height = 35,
this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
2023-07-23 20:08:09 +00:00
child: SizedBox(
width: width,
child: Center(child: child),
),
);
2019-03-11 20:38:05 +00:00
return Padding(
padding: vStandardVerticalPadding,
child: Container(
width: width,
height: height,
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: Theme.of(context).brightness == Brightness.dark
? vButtonShadowDark
: vButtonShadow,
2019-03-11 20:38:05 +00:00
offset: Offset(-5, 5),
blurRadius: 10,
),
]),
child: Material(
borderRadius: BorderRadius.circular(3),
color: Theme.of(context).colorScheme.primary,
2019-03-11 20:38:05 +00:00
child: InkWell(
onTap: onPressed,
child: Center(
child: child,
)),
),
));
}
}