mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
resposnive text length of space model name
This commit is contained in:
@ -18,8 +18,10 @@ import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dynamic_
|
|||||||
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart';
|
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dynamic_room_widget.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
|
||||||
|
import 'package:syncrow_web/utils/string_utils.dart';
|
||||||
|
|
||||||
class SpaceModelCardWidget extends StatelessWidget {
|
class SpaceModelCardWidget extends StatelessWidget with HelperResponsiveLayout {
|
||||||
final SpaceTemplateModel model;
|
final SpaceTemplateModel model;
|
||||||
final BuildContext? pageContext;
|
final BuildContext? pageContext;
|
||||||
final bool topActionsDisabled;
|
final bool topActionsDisabled;
|
||||||
@ -76,14 +78,17 @@ class SpaceModelCardWidget extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Expanded(
|
||||||
model.modelName,
|
child: Text(
|
||||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
StringUtils.capitalizeFirstLetter(model.modelName),
|
||||||
color: Colors.black,
|
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
color: ColorsManager.blackColor,
|
||||||
),
|
fontWeight: FontWeight.bold,
|
||||||
maxLines: 1,
|
fontSize: isSmallScreenSize(context) ? 13 : 20,
|
||||||
overflow: TextOverflow.ellipsis,
|
),
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (!topActionsDisabled)
|
if (!topActionsDisabled)
|
||||||
Row(
|
Row(
|
||||||
@ -95,15 +100,12 @@ class SpaceModelCardWidget extends StatelessWidget {
|
|||||||
builder: (BuildContext dialogContext) {
|
builder: (BuildContext dialogContext) {
|
||||||
return BlocProvider<LinkSpaceToModelBloc>(
|
return BlocProvider<LinkSpaceToModelBloc>(
|
||||||
create: (_) => LinkSpaceToModelBloc(),
|
create: (_) => LinkSpaceToModelBloc(),
|
||||||
child: BlocListener<LinkSpaceToModelBloc,
|
child: BlocListener<LinkSpaceToModelBloc, LinkSpaceToModelState>(
|
||||||
LinkSpaceToModelState>(
|
|
||||||
listenWhen: (previous, current) {
|
listenWhen: (previous, current) {
|
||||||
return previous != current;
|
return previous != current;
|
||||||
},
|
},
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
final _bloc =
|
final _bloc = BlocProvider.of<LinkSpaceToModelBloc>(context);
|
||||||
BlocProvider.of<LinkSpaceToModelBloc>(
|
|
||||||
context);
|
|
||||||
if (state is SpaceModelLoading) {
|
if (state is SpaceModelLoading) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@ -111,19 +113,14 @@ class SpaceModelCardWidget extends StatelessWidget {
|
|||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Dialog(
|
return Dialog(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius:
|
borderRadius: BorderRadius.circular(20)),
|
||||||
BorderRadius.circular(
|
|
||||||
20)),
|
|
||||||
elevation: 10,
|
elevation: 10,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(
|
||||||
const EdgeInsets.symmetric(
|
vertical: 30, horizontal: 50),
|
||||||
vertical: 30,
|
|
||||||
horizontal: 50),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize:
|
mainAxisSize: MainAxisSize.min,
|
||||||
MainAxisSize.min,
|
|
||||||
children: [
|
children: [
|
||||||
CustomLoadingIndicator(),
|
CustomLoadingIndicator(),
|
||||||
],
|
],
|
||||||
@ -132,19 +129,14 @@ class SpaceModelCardWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else if (state
|
} else if (state is AlreadyHaveLinkedState) {
|
||||||
is AlreadyHaveLinkedState) {
|
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
showOverwriteDialog(
|
showOverwriteDialog(context, _bloc, model);
|
||||||
context, _bloc, model);
|
} else if (state is SpaceValidationSuccess) {
|
||||||
} else if (state
|
|
||||||
is SpaceValidationSuccess) {
|
|
||||||
_bloc.add(LinkSpaceModelEvent(
|
_bloc.add(LinkSpaceModelEvent(
|
||||||
isOverWrite: false,
|
isOverWrite: false, selectedSpaceMode: model.uuid));
|
||||||
selectedSpaceMode: model.uuid));
|
|
||||||
|
|
||||||
Future.delayed(
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
const Duration(seconds: 1), () {
|
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
@ -152,29 +144,23 @@ class SpaceModelCardWidget extends StatelessWidget {
|
|||||||
|
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder:
|
builder: (BuildContext dialogContext) {
|
||||||
(BuildContext dialogContext) {
|
|
||||||
return const LinkingSuccessful();
|
return const LinkingSuccessful();
|
||||||
},
|
},
|
||||||
).then((v) {
|
).then((v) {
|
||||||
Future.delayed(
|
Future.delayed(const Duration(seconds: 2), () {
|
||||||
const Duration(seconds: 2), () {
|
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else if (state
|
} else if (state is SpaceModelLinkSuccess) {
|
||||||
is SpaceModelLinkSuccess) {
|
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
Navigator.of(dialogContext).pop();
|
Navigator.of(dialogContext).pop();
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
builder: (BuildContext
|
builder: (BuildContext successDialogContext) {
|
||||||
successDialogContext) {
|
Future.delayed(const Duration(seconds: 2), () {
|
||||||
Future.delayed(
|
Navigator.of(successDialogContext).pop();
|
||||||
const Duration(seconds: 2), () {
|
|
||||||
Navigator.of(successDialogContext)
|
|
||||||
.pop();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return const LinkingSuccessful();
|
return const LinkingSuccessful();
|
||||||
@ -232,8 +218,7 @@ class SpaceModelCardWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (productTagCount.isNotEmpty &&
|
if (productTagCount.isNotEmpty && model.subspaceModels != null)
|
||||||
model.subspaceModels != null)
|
|
||||||
Container(
|
Container(
|
||||||
width: 1.0,
|
width: 1.0,
|
||||||
color: ColorsManager.softGray,
|
color: ColorsManager.softGray,
|
||||||
|
6
lib/utils/string_utils.dart
Normal file
6
lib/utils/string_utils.dart
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
class StringUtils {
|
||||||
|
static String capitalizeFirstLetter(String text) {
|
||||||
|
if (text.isEmpty) return text;
|
||||||
|
return text[0].toUpperCase() + text.substring(1);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user