mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Refactor SpaceDetailsDialog to improve code readability and structure by simplifying widget hierarchy and enhancing the use of Bloc for state management.
This commit is contained in:
@ -27,7 +27,8 @@ class SpaceDetailsDialog extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => SpaceDetailsModelBloc(initialState: space),
|
create: (context) => SpaceDetailsModelBloc(initialState: space),
|
||||||
child: Builder(builder: (context) {
|
child: Builder(
|
||||||
|
builder: (context) {
|
||||||
final space = context.watch<SpaceDetailsModelBloc>().state;
|
final space = context.watch<SpaceDetailsModelBloc>().state;
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: title,
|
title: title,
|
||||||
@ -38,10 +39,7 @@ class SpaceDetailsDialog extends StatelessWidget {
|
|||||||
spacing: 20,
|
spacing: 20,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(child: SpaceIconPicker(iconPath: space.icon)),
|
||||||
flex: 1,
|
|
||||||
child: SpaceIconPicker(iconPath: space.icon)
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -77,7 +75,8 @@ class SpaceDetailsDialog extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user