mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +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/utils/color_manager.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 BuildContext? pageContext;
|
||||
final bool topActionsDisabled;
|
||||
@ -76,14 +78,17 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
model.modelName,
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
Expanded(
|
||||
child: Text(
|
||||
StringUtils.capitalizeFirstLetter(model.modelName),
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
color: ColorsManager.blackColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: isSmallScreenSize(context) ? 13 : 20,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (!topActionsDisabled)
|
||||
Row(
|
||||
@ -95,15 +100,12 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
builder: (BuildContext dialogContext) {
|
||||
return BlocProvider<LinkSpaceToModelBloc>(
|
||||
create: (_) => LinkSpaceToModelBloc(),
|
||||
child: BlocListener<LinkSpaceToModelBloc,
|
||||
LinkSpaceToModelState>(
|
||||
child: BlocListener<LinkSpaceToModelBloc, LinkSpaceToModelState>(
|
||||
listenWhen: (previous, current) {
|
||||
return previous != current;
|
||||
},
|
||||
listener: (context, state) {
|
||||
final _bloc =
|
||||
BlocProvider.of<LinkSpaceToModelBloc>(
|
||||
context);
|
||||
final _bloc = BlocProvider.of<LinkSpaceToModelBloc>(context);
|
||||
if (state is SpaceModelLoading) {
|
||||
showDialog(
|
||||
context: context,
|
||||
@ -111,19 +113,14 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
20)),
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
elevation: 10,
|
||||
backgroundColor: Colors.white,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
vertical: 30,
|
||||
horizontal: 50),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 30, horizontal: 50),
|
||||
child: Column(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CustomLoadingIndicator(),
|
||||
],
|
||||
@ -132,19 +129,14 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
);
|
||||
} else if (state
|
||||
is AlreadyHaveLinkedState) {
|
||||
} else if (state is AlreadyHaveLinkedState) {
|
||||
Navigator.of(dialogContext).pop();
|
||||
showOverwriteDialog(
|
||||
context, _bloc, model);
|
||||
} else if (state
|
||||
is SpaceValidationSuccess) {
|
||||
showOverwriteDialog(context, _bloc, model);
|
||||
} else if (state is SpaceValidationSuccess) {
|
||||
_bloc.add(LinkSpaceModelEvent(
|
||||
isOverWrite: false,
|
||||
selectedSpaceMode: model.uuid));
|
||||
isOverWrite: false, selectedSpaceMode: model.uuid));
|
||||
|
||||
Future.delayed(
|
||||
const Duration(seconds: 1), () {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
Navigator.of(dialogContext).pop();
|
||||
Navigator.of(dialogContext).pop();
|
||||
@ -152,29 +144,23 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext dialogContext) {
|
||||
builder: (BuildContext dialogContext) {
|
||||
return const LinkingSuccessful();
|
||||
},
|
||||
).then((v) {
|
||||
Future.delayed(
|
||||
const Duration(seconds: 2), () {
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
});
|
||||
});
|
||||
} else if (state
|
||||
is SpaceModelLinkSuccess) {
|
||||
} else if (state is SpaceModelLinkSuccess) {
|
||||
Navigator.of(dialogContext).pop();
|
||||
Navigator.of(dialogContext).pop();
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext
|
||||
successDialogContext) {
|
||||
Future.delayed(
|
||||
const Duration(seconds: 2), () {
|
||||
Navigator.of(successDialogContext)
|
||||
.pop();
|
||||
builder: (BuildContext successDialogContext) {
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
Navigator.of(successDialogContext).pop();
|
||||
});
|
||||
|
||||
return const LinkingSuccessful();
|
||||
@ -232,8 +218,7 @@ class SpaceModelCardWidget extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (productTagCount.isNotEmpty &&
|
||||
model.subspaceModels != null)
|
||||
if (productTagCount.isNotEmpty && model.subspaceModels != null)
|
||||
Container(
|
||||
width: 1.0,
|
||||
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