mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Extracted Add Devices
button into a private method.
This commit is contained in:
@ -53,18 +53,18 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: screenWidth * 0.25,
|
width: screenWidth * 0.25,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.textFieldGreyColor,
|
color: ColorsManager.textFieldGreyColor,
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: ColorsManager.textFieldGreyColor,
|
color: ColorsManager.textFieldGreyColor,
|
||||||
width: 3.0,
|
width: 3,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
spacing: 8.0,
|
spacing: 8,
|
||||||
runSpacing: 8.0,
|
runSpacing: 8,
|
||||||
children: [
|
children: [
|
||||||
..._groupedTags.entries.map((entry) {
|
..._groupedTags.entries.map((entry) {
|
||||||
return Chip(
|
return Chip(
|
||||||
@ -120,29 +120,33 @@ class TagChipDisplay extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return TextButton(
|
return _buildAddDevicesButton(context);
|
||||||
onPressed: () => showDialog<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AddDeviceTypeModelWidget(
|
|
||||||
products: products,
|
|
||||||
subspaces: subspaces,
|
|
||||||
allTags: allTags,
|
|
||||||
spaceName: spaceNameController.text,
|
|
||||||
pageContext: pageContext,
|
|
||||||
isCreate: true,
|
|
||||||
spaceModel: spaceModel,
|
|
||||||
otherSpaceModels: otherSpaceModels,
|
|
||||||
projectTags: projectTags,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
),
|
|
||||||
child: const ButtonContentWidget(
|
|
||||||
icon: Icons.add,
|
|
||||||
label: 'Add Devices',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildAddDevicesButton(BuildContext context) {
|
||||||
|
return TextButton(
|
||||||
|
onPressed: () => showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AddDeviceTypeModelWidget(
|
||||||
|
products: products,
|
||||||
|
subspaces: subspaces,
|
||||||
|
allTags: allTags,
|
||||||
|
spaceName: spaceNameController.text,
|
||||||
|
pageContext: pageContext,
|
||||||
|
isCreate: true,
|
||||||
|
spaceModel: spaceModel,
|
||||||
|
otherSpaceModels: otherSpaceModels,
|
||||||
|
projectTags: projectTags,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextButton.styleFrom(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
),
|
||||||
|
child: const ButtonContentWidget(
|
||||||
|
icon: Icons.add,
|
||||||
|
label: 'Add Devices',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user