change spaceHint and size

This commit is contained in:
mohammad
2025-06-10 11:41:42 +03:00
parent 662fe211eb
commit ed06a760d2
3 changed files with 107 additions and 74 deletions

View File

@ -51,53 +51,74 @@ class _SpaceTreeDropdownState extends State<SpaceTreeDropdown> {
: state.communityList; : state.communityList;
final selectedCommunity = _findCommunity(communities, _selectedSpaceId); final selectedCommunity = _findCommunity(communities, _selectedSpaceId);
return CompositedTransformTarget( return Column(
link: _layerLink, crossAxisAlignment: CrossAxisAlignment.start,
child: GestureDetector( mainAxisAlignment: MainAxisAlignment.start,
onTap: _toggleDropdown, children: [
child: Container( Padding(
height: 46, padding: const EdgeInsets.symmetric(
decoration: BoxDecoration( horizontal: 10,
border: Border.all(color: Colors.grey.shade300),
borderRadius: BorderRadius.circular(12),
), ),
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 8), child: Text(
child: Row( "Community",
mainAxisAlignment: MainAxisAlignment.spaceBetween, style: Theme.of(context).textTheme.bodyMedium!.copyWith(
children: [ fontWeight: FontWeight.w400,
Padding( fontSize: 13,
padding: const EdgeInsets.symmetric(horizontal: 12), color: ColorsManager.blackColor,
child: Text(
selectedCommunity?.name ?? 'Select a space',
style: TextStyle(
color: selectedCommunity != null
? Colors.black
: Colors.grey,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w400,
fontSize: 15,
),
), ),
),
Container(
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: const BorderRadius.only(
topRight: Radius.circular(10),
bottomRight: Radius.circular(10),
),
),
height: 45,
width: 35,
child: const Icon(
Icons.keyboard_arrow_down,
color: ColorsManager.textGray,
),
),
],
), ),
), ),
), CompositedTransformTarget(
link: _layerLink,
child: GestureDetector(
onTap: _toggleDropdown,
child: Container(
height: 46,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey.shade300),
borderRadius: BorderRadius.circular(12),
),
margin: const EdgeInsets.symmetric(
horizontal: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
selectedCommunity?.name ?? 'Please Select',
style: TextStyle(
color: selectedCommunity != null
? ColorsManager.blackColor
: ColorsManager.textGray,
overflow: TextOverflow.ellipsis,
fontWeight: FontWeight.w400,
fontSize: 13,
),
),
),
Container(
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: const BorderRadius.only(
topRight: Radius.circular(10),
bottomRight: Radius.circular(10),
),
),
height: 45,
width: 33,
child: const Icon(
Icons.keyboard_arrow_down,
color: ColorsManager.textGray,
),
),
],
),
),
),
),
],
); );
}, },
); );

View File

@ -31,7 +31,7 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
final spaces = _bloc.spacesOnlyWithDevices; final spaces = _bloc.spacesOnlyWithDevices;
final isLoadingCommunities = state is CommunitiesLoadingState; final isLoadingCommunities = state is CommunitiesLoadingState;
final isLoadingSpaces = state is SpaceWithDeviceLoadingState; final isLoadingSpaces = state is SpaceWithDeviceLoadingState;
String spaceHint = 'Select a community first'; String spaceHint = 'Please Select';
if (_selectedCommunity != null) { if (_selectedCommunity != null) {
if (isLoadingSpaces) { if (isLoadingSpaces) {
spaceHint = 'Loading spaces...'; spaceHint = 'Loading spaces...';
@ -55,7 +55,9 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
'Create New Routines', 'Create New Routines',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyMedium!.copyWith( style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: ColorsManager.primaryColor, color: ColorsManager.spaceColor,
fontSize: 20,
fontWeight: FontWeight.w700,
), ),
), ),
content: Stack( content: Stack(
@ -64,32 +66,44 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Divider(), const Divider(),
Padding( const SizedBox(height: 20),
padding: const EdgeInsets.only(left: 15, right: 15), Column(
child: SpaceTreeDropdown( children: [
selectedSpaceId: _selectedId, Padding(
onChanged: (String? newValue) { padding:
setState(() => _selectedId = newValue!); const EdgeInsets.only(left: 13, right: 8),
if (_selectedId != null) { child: Column(
_bloc.add( children: [
SpaceOnlyWithDevicesEvent(_selectedId!)); SpaceTreeDropdown(
} selectedSpaceId: _selectedId,
}, onChanged: (String? newValue) {
)), setState(() => _selectedId = newValue!);
const SizedBox(height: 5), if (_selectedId != null) {
Padding( _bloc.add(SpaceOnlyWithDevicesEvent(
padding: const EdgeInsets.only(left: 15, right: 15), _selectedId!));
child: SpaceDropdown( }
hintMessage: spaceHint, },
spaces: spaces, ),
selectedValue: _selectedSpace, ],
onChanged: (String? newValue) { )),
setState(() { const SizedBox(height: 5),
_selectedSpace = newValue; const SizedBox(height: 8),
}); Padding(
}, padding: const EdgeInsets.only(left: 15, right: 15),
), child: SpaceDropdown(
hintMessage: spaceHint,
spaces: spaces,
selectedValue: _selectedSpace,
onChanged: (String? newValue) {
setState(() {
_selectedSpace = newValue;
});
},
),
),
],
), ),
const SizedBox(height: 20),
const Divider(), const Divider(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart'; import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/color_manager.dart';
class SpaceDropdown extends StatelessWidget { class SpaceDropdown extends StatelessWidget {
final List<SpaceModel> spaces; final List<SpaceModel> spaces;
final String? selectedValue; final String? selectedValue;
@ -21,7 +20,7 @@ class SpaceDropdown extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.only(left: 10),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -33,7 +32,6 @@ class SpaceDropdown extends StatelessWidget {
color: ColorsManager.blackColor, color: ColorsManager.blackColor,
), ),
), ),
const SizedBox(height: 8),
SizedBox( SizedBox(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -90,7 +88,7 @@ class SpaceDropdown extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Expanded( Expanded(
flex: 5, flex: 6,
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 10), padding: const EdgeInsets.only(left: 10),
child: Text( child: Text(