From 073916d4ac5dde73ffa394cc79cfaffe463e322d Mon Sep 17 00:00:00 2001 From: hannathkadher Date: Wed, 29 Jan 2025 10:21:06 +0400 Subject: [PATCH] updated text theme --- .../widgets/dialogs/create_space_dialog.dart | 43 ++++++----- .../all_spaces/widgets/space_widget.dart | 6 +- .../assign_tag/views/assign_tag_dialog.dart | 34 +++++---- .../views/assign_tag_models_dialog.dart | 34 ++++----- .../view/create_community_dialog.dart | 4 +- .../views/create_subspace_model_dialog.dart | 71 ++++++++--------- .../views/create_subspace_model_dialog.dart | 76 ++++++++++--------- .../space_model/view/space_model_page.dart | 5 +- .../widgets/dynamic_room_widget.dart | 2 +- 9 files changed, 145 insertions(+), 130 deletions(-) diff --git a/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart b/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart index 94753107..ae4349ec 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/dialogs/create_space_dialog.dart @@ -173,14 +173,13 @@ class CreateSpaceDialogState extends State { } }); }, - style: const TextStyle(color: Colors.black), + style: Theme.of(context).textTheme.bodyMedium, decoration: InputDecoration( hintText: 'Please enter the name', - hintStyle: const TextStyle( - fontSize: 14, - color: ColorsManager.lightGrayColor, - fontWeight: FontWeight.w400, - ), + hintStyle: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith(color: ColorsManager.lightGrayColor), filled: true, fillColor: ColorsManager.boxColor, enabledBorder: OutlineInputBorder( @@ -253,8 +252,11 @@ class CreateSpaceDialogState extends State { Chip( label: Text( selectedSpaceModel?.modelName ?? '', - style: const TextStyle( - color: ColorsManager.spaceColor), + style: Theme.of(context) + .textTheme + .bodyMedium! + .copyWith( + color: ColorsManager.spaceColor), ), backgroundColor: ColorsManager.whiteColors, shape: RoundedRectangleBorder( @@ -287,25 +289,25 @@ class CreateSpaceDialogState extends State { ), ), const SizedBox(height: 25), - const Row( + Row( children: [ - Expanded( + const Expanded( child: Divider( color: ColorsManager.neutralGray, thickness: 1.0, ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 6.0), + padding: const EdgeInsets.symmetric(horizontal: 6.0), child: Text( 'OR', - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.bold, - ), + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(fontWeight: FontWeight.bold), ), ), - Expanded( + const Expanded( child: Divider( color: ColorsManager.neutralGray, thickness: 1.0, @@ -418,9 +420,12 @@ class CreateSpaceDialogState extends State { ), label: Text( 'x${entry.value}', // Show count - style: const TextStyle( - color: ColorsManager.spaceColor, - ), + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: ColorsManager + .spaceColor), ), backgroundColor: ColorsManager.whiteColors, diff --git a/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart b/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart index 6e1f50c1..62d8197c 100644 --- a/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart +++ b/lib/pages/spaces_management/all_spaces/widgets/space_widget.dart @@ -20,8 +20,7 @@ class SpaceWidget extends StatelessWidget { top: position.dy, child: GestureDetector( onTap: onTap, - child: - Container( + child: Container( padding: const EdgeInsets.all(8.0), decoration: BoxDecoration( color: ColorsManager.whiteColors, @@ -39,11 +38,10 @@ class SpaceWidget extends StatelessWidget { children: [ const Icon(Icons.location_on, color: ColorsManager.spaceColor), const SizedBox(width: 8), - Text(name, style: const TextStyle(fontSize: 16)), + Text(name, style: Theme.of(context).textTheme.bodyMedium), ], ), ), - ), ); } diff --git a/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart b/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart index bfb56d7a..cb1f7b46 100644 --- a/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart +++ b/lib/pages/spaces_management/assign_tag/views/assign_tag_dialog.dart @@ -97,21 +97,22 @@ class AssignTagDialog extends StatelessWidget { ], rows: state.tags.isEmpty ? [ - const DataRow(cells: [ + DataRow(cells: [ DataCell( Center( - child: Text( - 'No Data Available', - style: TextStyle( - fontSize: 14, - color: ColorsManager.lightGrayColor, - ), - ), + child: Text('No Data Available', + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: ColorsManager + .lightGrayColor, + )), ), ), - DataCell(SizedBox()), - DataCell(SizedBox()), - DataCell(SizedBox()), + const DataCell(SizedBox()), + const DataCell(SizedBox()), + const DataCell(SizedBox()), ]) ] : List.generate(state.tags.length, (index) { @@ -213,10 +214,11 @@ class AssignTagDialog extends StatelessWidget { ), ), if (state.errorMessage != null) - Text( - state.errorMessage!, - style: const TextStyle(color: ColorsManager.warningRed), - ), + Text(state.errorMessage!, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: ColorsManager.warningRed)), ], ), ), @@ -320,7 +322,7 @@ class AssignTagDialog extends StatelessWidget { ); } } - for (var tag in modifiedTags.toList()) { + for (var tag in modifiedTags.toList()) { if (modifiedSubspaces.isEmpty) continue; final prevIndice = checkTagExistInSubspace(tag, modifiedSubspaces); diff --git a/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart b/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart index ebec47e5..9696723a 100644 --- a/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart +++ b/lib/pages/spaces_management/assign_tag_models/views/assign_tag_models_dialog.dart @@ -112,22 +112,22 @@ class AssignTagModelsDialog extends StatelessWidget { ], rows: state.tags.isEmpty ? [ - const DataRow(cells: [ + DataRow(cells: [ DataCell( Center( - child: Text( - 'No Data Available', - style: TextStyle( - fontSize: 14, - color: - ColorsManager.lightGrayColor, - ), - ), + child: Text('No Devices Available', + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: ColorsManager + .lightGrayColor, + )), ), ), - DataCell(SizedBox()), - DataCell(SizedBox()), - DataCell(SizedBox()), + const DataCell(SizedBox()), + const DataCell(SizedBox()), + const DataCell(SizedBox()), ]) ] : List.generate(state.tags.length, (index) { @@ -233,11 +233,11 @@ class AssignTagModelsDialog extends StatelessWidget { ), ), if (state.errorMessage != null) - Text( - state.errorMessage!, - style: const TextStyle( - color: ColorsManager.warningRed), - ), + Text(state.errorMessage!, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: ColorsManager.warningRed)), ], ), ), diff --git a/lib/pages/spaces_management/create_community/view/create_community_dialog.dart b/lib/pages/spaces_management/create_community/view/create_community_dialog.dart index 1a5460d1..13e676b5 100644 --- a/lib/pages/spaces_management/create_community/view/create_community_dialog.dart +++ b/lib/pages/spaces_management/create_community/view/create_community_dialog.dart @@ -77,9 +77,7 @@ class CreateCommunityDialog extends StatelessWidget { .read() .add(ValidateCommunityNameEvent(value)); }, - style: const TextStyle( - color: ColorsManager.blackColor, - ), + style: Theme.of(context).textTheme.bodyMedium, decoration: InputDecoration( hintText: 'Please enter the community name', filled: true, diff --git a/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart b/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart index 09c51f16..0a2a01e5 100644 --- a/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart +++ b/lib/pages/spaces_management/create_subspace/views/create_subspace_model_dialog.dart @@ -102,12 +102,13 @@ class CreateSubSpaceDialog extends StatelessWidget { duplicateIndices.indexOf(index) != 0; return Chip( - label: Text( - subSpace.subspaceName, - style: const TextStyle( - color: ColorsManager.spaceColor, - ), - ), + label: Text(subSpace.subspaceName, + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: + ColorsManager.spaceColor)), backgroundColor: ColorsManager.whiteColors, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -143,27 +144,29 @@ class CreateSubSpaceDialog extends StatelessWidget { SizedBox( width: 200, child: TextField( - controller: textController, - decoration: InputDecoration( - border: InputBorder.none, - hintText: state.subSpaces.isEmpty - ? 'Please enter the name' - : null, - hintStyle: const TextStyle( - color: ColorsManager.lightGrayColor), - ), - onSubmitted: (value) { - if (value.trim().isNotEmpty) { - context.read().add( - AddSubSpace(SubspaceModel( - subspaceName: value.trim(), - disabled: false))); - textController.clear(); - } - }, - style: const TextStyle( - color: ColorsManager.blackColor), - ), + controller: textController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: state.subSpaces.isEmpty + ? 'Please enter the name' + : null, + hintStyle: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: ColorsManager + .lightGrayColor)), + onSubmitted: (value) { + if (value.trim().isNotEmpty) { + context.read().add( + AddSubSpace(SubspaceModel( + subspaceName: value.trim(), + disabled: false))); + textController.clear(); + } + }, + style: + Theme.of(context).textTheme.bodyMedium), ), ], ), @@ -171,13 +174,13 @@ class CreateSubSpaceDialog extends StatelessWidget { if (state.errorMessage.isNotEmpty) Padding( padding: const EdgeInsets.only(top: 8.0), - child: Text( - state.errorMessage, - style: const TextStyle( - color: ColorsManager.warningRed, - fontSize: 12, - ), - ), + child: Text(state.errorMessage, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: ColorsManager.warningRed, + )), ), const SizedBox(height: 16), Row( diff --git a/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart b/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart index 4c0cb99f..7a39891b 100644 --- a/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart +++ b/lib/pages/spaces_management/create_subspace_model/views/create_subspace_model_dialog.dart @@ -94,12 +94,13 @@ class CreateSubSpaceModelDialog extends StatelessWidget { duplicateIndices.indexOf(index) != 0; return Chip( - label: Text( - subSpace.subspaceName, - style: const TextStyle( - color: ColorsManager.spaceColor, - ), - ), + label: Text(subSpace.subspaceName, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: ColorsManager.spaceColor, + )), backgroundColor: ColorsManager.whiteColors, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -135,28 +136,33 @@ class CreateSubSpaceModelDialog extends StatelessWidget { SizedBox( width: 200, child: TextField( - controller: textController, - decoration: InputDecoration( - border: InputBorder.none, - hintText: state.subSpaces.isEmpty - ? 'Please enter the name' - : null, - hintStyle: const TextStyle( - color: ColorsManager.lightGrayColor), - ), - onSubmitted: (value) { - if (value.trim().isNotEmpty) { - context.read().add( - AddSubSpaceModel( - SubspaceTemplateModel( - subspaceName: value.trim(), - disabled: false))); - textController.clear(); - } - }, - style: const TextStyle( - color: ColorsManager.blackColor), - ), + controller: textController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: state.subSpaces.isEmpty + ? 'Please enter the name' + : null, + hintStyle: Theme.of(context) + .textTheme + .bodySmall! + .copyWith( + color: ColorsManager + .lightGrayColor)), + onSubmitted: (value) { + if (value.trim().isNotEmpty) { + context.read().add( + AddSubSpaceModel( + SubspaceTemplateModel( + subspaceName: value.trim(), + disabled: false))); + textController.clear(); + } + }, + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: ColorsManager.blackColor)), ), ], ), @@ -164,13 +170,13 @@ class CreateSubSpaceModelDialog extends StatelessWidget { if (state.errorMessage.isNotEmpty) Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: Text( - state.errorMessage, - style: const TextStyle( - color: ColorsManager.red, - fontSize: 12, - ), - ), + child: Text(state.errorMessage, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith( + color: ColorsManager.red, + )), ), const SizedBox(height: 16), Row( diff --git a/lib/pages/spaces_management/space_model/view/space_model_page.dart b/lib/pages/spaces_management/space_model/view/space_model_page.dart index cb7bc0c9..ec6d54a0 100644 --- a/lib/pages/spaces_management/space_model/view/space_model_page.dart +++ b/lib/pages/spaces_management/space_model/view/space_model_page.dart @@ -97,7 +97,10 @@ class SpaceModelPage extends StatelessWidget { return Center( child: Text( 'Error: ${state.message}', - style: const TextStyle(color: ColorsManager.warningRed), + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: ColorsManager.warningRed), ), ); } diff --git a/lib/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart b/lib/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart index e24c7704..f3da4122 100644 --- a/lib/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart +++ b/lib/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart @@ -29,7 +29,7 @@ class DynamicRoomWidget extends StatelessWidget { final TextPainter textPainter = TextPainter( text: TextSpan( text: subspace.subspaceName, - style: const TextStyle(fontSize: 16), + style: Theme.of(context).textTheme.bodyMedium ), textDirection: TextDirection.ltr, )..layout();