This commit is contained in:
2022-10-19 10:54:45 +08:00
commit 153e28aa4e
115 changed files with 4215 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import 'package:chat/configs/app_colors.dart';
import 'package:flutter/material.dart';
class CustomPrimaryButton extends StatelessWidget {
final VoidCallback? onPressed;
final String text;
final double padding;
const CustomPrimaryButton({
Key? key,
required this.text,
this.onPressed,
this.padding = 0,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: onPressed,
style: ButtonStyle(
padding: MaterialStateProperty.resolveWith(
(states) {
return EdgeInsets.all(padding);
},
),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
),
),
backgroundColor: MaterialStateProperty.resolveWith(
(states) {
if (states.contains(MaterialState.disabled)) {
return AppColors.primary.withAlpha(128);
} else {
return AppColors.primary;
}
},
),
foregroundColor: MaterialStateProperty.resolveWith(
(states) {
if (states.contains(MaterialState.disabled)) {
return AppColors.white;
} else {
return AppColors.white;
}
},
),
),
child: Text(
text,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
),
);
}
}