89 lines
2.3 KiB
Dart
89 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../utils/auth_utils.dart';
|
|
|
|
class CustomTextFieldItnerarySubWrapper extends StatefulWidget {
|
|
final Widget child;
|
|
final bool isFocused;
|
|
final bool isDesktop;
|
|
final double? width;
|
|
final Color? color;
|
|
final VoidCallback? onFocusChange; // Callback for focus handling
|
|
final EdgeInsetsGeometry padding;
|
|
|
|
const CustomTextFieldItnerarySubWrapper({
|
|
super.key,
|
|
required this.child,
|
|
required this.isFocused,
|
|
required this.isDesktop,
|
|
this.width,
|
|
this.color = Colors.white,
|
|
this.onFocusChange,
|
|
this.padding = const EdgeInsets.symmetric(horizontal: 12),
|
|
});
|
|
|
|
@override
|
|
_CustomTextFieldItnerarySubWrapperState createState() =>
|
|
_CustomTextFieldItnerarySubWrapperState();
|
|
}
|
|
|
|
class _CustomTextFieldItnerarySubWrapperState
|
|
extends State<CustomTextFieldItnerarySubWrapper> {
|
|
Color? layoutColor;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
loadInitialData();
|
|
});
|
|
}
|
|
|
|
void loadInitialData() async {
|
|
String? layoutString = await getLayoutColor();
|
|
|
|
setState(() {
|
|
layoutColor =
|
|
layoutString != null
|
|
? Color(int.parse(layoutString))
|
|
: Colors.redAccent;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width:
|
|
widget.width ?? // Use custom width if provided, else default
|
|
(widget.isDesktop
|
|
? MediaQuery.of(context).size.width * 0.15
|
|
: MediaQuery.of(context).size.width * 0.8),
|
|
padding: widget.padding,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10),
|
|
color: Colors.white,
|
|
|
|
border: Border.all(
|
|
color: widget.isFocused ? layoutColor! : Color(0xFFD6D5E6),
|
|
// color: widget.isFocused ? Color(0xFF78B4FC) : Color(0xFFD6D5E6),
|
|
width: widget.isFocused ? 1.0 : 0.5,
|
|
),
|
|
boxShadow:
|
|
widget.isFocused
|
|
? [
|
|
BoxShadow(
|
|
color: Colors.white,
|
|
// color: Color.fromRGBO(120, 180, 252, 0.3),
|
|
blurRadius: 10,
|
|
spreadRadius: 2,
|
|
offset: Offset(0, 4),
|
|
),
|
|
]
|
|
: [],
|
|
),
|
|
child: widget.child,
|
|
);
|
|
}
|
|
}
|