33 lines
828 B
Dart
33 lines
828 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class FitButton extends StatelessWidget {
|
||
|
final void Function() onPressed;
|
||
|
final String text;
|
||
|
|
||
|
const FitButton({Key? key, required this.onPressed, required this.text})
|
||
|
: super(key: key);
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return LayoutBuilder(
|
||
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||
|
return SizedBox(
|
||
|
width: constraints.maxWidth,
|
||
|
height: constraints.maxHeight,
|
||
|
child: Container(
|
||
|
padding: EdgeInsets.all(10),
|
||
|
child: MaterialButton(
|
||
|
onPressed: onPressed,
|
||
|
child: Container(
|
||
|
child: Center(
|
||
|
child: Text(text),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
}
|