mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
68 lines
2.2 KiB
Dart
68 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
import 'color_manager.dart';
|
|
|
|
InputDecoration? textBoxDecoration({bool suffixIcon = false}) =>
|
|
InputDecoration(
|
|
focusColor: ColorsManager.grayColor,
|
|
suffixIcon: suffixIcon ? const Icon(Icons.search) : null,
|
|
hintText: 'Search',
|
|
filled: true, // Enable background filling
|
|
fillColor: const Color(0xffF5F6F7), // Set the background color
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8), // Add border radius
|
|
borderSide: BorderSide.none, // Remove the underline
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8), // Add border radius
|
|
borderSide: BorderSide.none, // Remove the underline
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(8), // Add border radius
|
|
borderSide: BorderSide.none, // Remove the underline
|
|
),
|
|
errorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.red, width: 2),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
focusedErrorBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Colors.red, width: 2),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
);
|
|
|
|
BoxDecoration containerDecoration = BoxDecoration(
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 5,
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 3), // changes position of shadow
|
|
),
|
|
],
|
|
color: ColorsManager.boxColor,
|
|
borderRadius: const BorderRadius.all(Radius.circular(10)));
|
|
|
|
|
|
/// A function to display a customizable toast message
|
|
void showCustomToast({
|
|
required String message,
|
|
ToastGravity gravity = ToastGravity.BOTTOM,
|
|
Color textColor = Colors.white,
|
|
Toast toastLength = Toast.LENGTH_SHORT,
|
|
int timeInSecForIosWeb = 2,
|
|
double fontSize = 16.0,
|
|
}) {
|
|
Fluttertoast.showToast(
|
|
msg: message,
|
|
webBgColor: "linear-gradient(to right, #dc1c13, #dc1c13)",
|
|
webPosition:'right' ,
|
|
toastLength: toastLength,
|
|
webShowClose: true,
|
|
gravity: gravity,
|
|
timeInSecForIosWeb: timeInSecForIosWeb,
|
|
textColor: textColor,
|
|
fontSize: fontSize,
|
|
);
|
|
}
|