import 'package:flutter/material.dart'; import 'package:syncrow_web/pages/common/buttons/default_button.dart'; import 'package:syncrow_web/pages/common/text_field/custom_text_field.dart'; import 'package:syncrow_web/pages/routiens/helper/setting_helper.dart'; import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/style.dart'; class RoutineSearchAndButtons extends StatelessWidget { const RoutineSearchAndButtons({ super.key, }); @override Widget build(BuildContext context) { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { return Wrap( runSpacing: 16, children: [ Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ Expanded( child: Wrap( spacing: 12, runSpacing: 12, crossAxisAlignment: WrapCrossAlignment.end, children: [ ConstrainedBox( constraints: BoxConstraints( maxWidth: constraints.maxWidth > 700 ? 450 : constraints.maxWidth - 32), child: StatefulTextField( title: 'Routine Name', height: 40, controller: TextEditingController(), hintText: 'Please enter the name', boxDecoration: containerWhiteDecoration, elevation: 0, borderRadius: 15, width: 450, ), ), (constraints.maxWidth <= 1000) ? const SizedBox() : SizedBox( height: 40, width: 200, child: Center( child: DefaultButton( onPressed: () async { final result = await SettingHelper.showSettingDialog( context: context, isAutomation: true); }, borderRadius: 15, elevation: 0, borderColor: ColorsManager.greyColor, backgroundColor: ColorsManager.boxColor, child: const Text( 'Settings', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, color: ColorsManager.primaryColor, ), ), ), ), ), ], ), ), if (constraints.maxWidth > 1000) Row( mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 40, width: 200, child: Center( child: DefaultButton( onPressed: () {}, borderRadius: 15, elevation: 0, borderColor: ColorsManager.greyColor, backgroundColor: ColorsManager.boxColor, child: const Text( 'Cancel', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, color: ColorsManager.blackColor, ), ), ), ), ), const SizedBox(width: 12), SizedBox( height: 40, width: 200, child: Center( child: DefaultButton( onPressed: () {}, borderRadius: 15, elevation: 0, backgroundColor: ColorsManager.primaryColor, child: const Text( 'Save', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, color: ColorsManager.whiteColors, ), ), ), ), ), ], ), ], ), if (constraints.maxWidth <= 1000) Wrap( runSpacing: 12, children: [ SizedBox( height: 40, width: 200, child: Center( child: DefaultButton( onPressed: () {}, borderRadius: 15, elevation: 0, borderColor: ColorsManager.greyColor, backgroundColor: ColorsManager.boxColor, child: const Text( 'Settings', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, color: ColorsManager.primaryColor, ), ), ), ), ), const SizedBox(width: 12), SizedBox( height: 40, width: 200, child: Center( child: DefaultButton( onPressed: () {}, borderRadius: 15, elevation: 0, borderColor: ColorsManager.greyColor, backgroundColor: ColorsManager.boxColor, child: const Text( 'Cancel', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, color: ColorsManager.blackColor, ), ), ), ), ), const SizedBox(width: 12), SizedBox( height: 40, width: 200, child: Center( child: DefaultButton( onPressed: () {}, borderRadius: 15, elevation: 0, backgroundColor: ColorsManager.primaryColor, child: const Text( 'Save', textAlign: TextAlign.center, style: TextStyle( fontSize: 12, color: ColorsManager.whiteColors, ), ), ), ), ), ], ), ], ); }, ); } }