mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
46 lines
1.1 KiB
Dart
46 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class DefaultTextButton extends StatelessWidget {
|
|
const DefaultTextButton({
|
|
super.key,
|
|
this.enabled = true,
|
|
this.onPressed,
|
|
required this.text,
|
|
this.isSecondary = false,
|
|
});
|
|
|
|
final void Function()? onPressed;
|
|
final String text;
|
|
final bool isSecondary;
|
|
|
|
final bool enabled;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextButton(
|
|
onPressed: enabled ? onPressed : null,
|
|
style: isSecondary
|
|
? null
|
|
: ButtonStyle(
|
|
backgroundColor: MaterialStateProperty.all(
|
|
enabled ? ColorsManager.primaryColor : Colors.grey),
|
|
shape: MaterialStateProperty.all(
|
|
RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
),
|
|
),
|
|
child: Text(
|
|
text,
|
|
style: TextStyle(
|
|
color: isSecondary
|
|
? Colors.black
|
|
: enabled
|
|
? Colors.white
|
|
: Colors.black),
|
|
),
|
|
);
|
|
}
|
|
}
|