mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-27 21:24:55 +00:00
Compare commits
14 Commits
Energy-Dev
...
upgrade-pr
| Author | SHA1 | Date | |
|---|---|---|---|
| 7109f3712a | |||
| 88480142e1 | |||
| e867c29086 | |||
| a3b427c570 | |||
| 0b0e235f26 | |||
| c250fb4469 | |||
| 59ac1bd74d | |||
| bac1450c2b | |||
| 889461db7d | |||
| 27dbcb26f1 | |||
| 0c5db9dfeb | |||
| 1393a15eca | |||
| cd6bf32aed | |||
| f7f3843fa7 |
2
.github/workflows/pr-check.yml
vendored
2
.github/workflows/pr-check.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
|||||||
- name: Set up Flutter
|
- name: Set up Flutter
|
||||||
uses: subosito/flutter-action@v2
|
uses: subosito/flutter-action@v2
|
||||||
with:
|
with:
|
||||||
flutter-version: '3.27.3'
|
flutter-version: '3.32.1'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|||||||
@ -1,33 +1,27 @@
|
|||||||
# This file configures the analyzer, which statically analyzes Dart code to
|
include: package:very_good_analysis/analysis_options.yaml
|
||||||
# check for errors, warnings, and lints.
|
|
||||||
#
|
|
||||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
|
||||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
|
||||||
# invoked from the command line by running `flutter analyze`.
|
|
||||||
|
|
||||||
# The following line activates a set of recommended lints for Flutter apps,
|
|
||||||
# packages, and plugins designed to encourage good coding practices.
|
|
||||||
analyzer:
|
analyzer:
|
||||||
errors:
|
errors:
|
||||||
constant_identifier_names: ignore
|
strict_raw_type: warning
|
||||||
overridden_fields: ignore
|
argument_type_not_assignable: warning
|
||||||
include: package:flutter_lints/flutter.yaml
|
invalid_assignment: warning
|
||||||
|
return_of_invalid_type: warning
|
||||||
|
return_of_invalid_type_from_closure: warning
|
||||||
|
list_element_type_not_assignable: warning
|
||||||
|
for_in_of_invalid_type: warning
|
||||||
|
cast_nullable_to_non_nullable: warning
|
||||||
|
non_bool_condition: warning
|
||||||
|
field_initializer_not_assignable: warning
|
||||||
|
non_bool_negation_expression: warning
|
||||||
|
non_bool_operand: warning
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
|
||||||
# included above or to enable additional rules. A list of all available lints
|
|
||||||
# and their documentation is published at https://dart.dev/lints.
|
|
||||||
#
|
|
||||||
# Instead of disabling a lint rule for the entire project in the
|
|
||||||
# section below, it can also be suppressed for a single line of code
|
|
||||||
# or a specific dart file by using the `// ignore: name_of_lint` and
|
|
||||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
|
||||||
# producing the lint.
|
|
||||||
rules:
|
rules:
|
||||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
prefer_single_quotes: true
|
||||||
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
avoid_print: false
|
||||||
prefer_const_constructors: true
|
public_member_api_docs: false
|
||||||
|
sort_pub_dependencies: false
|
||||||
# Additional information about this file can be found at
|
one_member_abstracts: false
|
||||||
# https://dart.dev/guides/language/analysis-options
|
prefer_int_literals: false
|
||||||
|
sort_constructors_first: false
|
||||||
|
avoid_redundant_argument_values: false
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/device_info_model.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/settings_model/sub_space_model.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/device_setting/sub_space_dialog.dart';
|
import 'package:syncrow_web/pages/device_managment/device_setting/sub_space_dialog.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/extension/build_context_x.dart';
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
import 'package:syncrow_web/web_layout/default_container.dart';
|
import 'package:syncrow_web/web_layout/default_container.dart';
|
||||||
|
|
||||||
@ -28,7 +30,7 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
Widget? trailing,
|
Widget? trailing,
|
||||||
required Color? valueColor}) {
|
required Color? valueColor}) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -39,6 +41,7 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
color: ColorsManager.grayColor,
|
color: ColorsManager.grayColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 15),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
value,
|
value,
|
||||||
@ -48,7 +51,7 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 12),
|
||||||
trailing ?? const SizedBox.shrink(),
|
trailing ?? const SizedBox.shrink(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -73,15 +76,15 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: infoRow(
|
child: infoRow(
|
||||||
label: 'Sub-Space:',
|
label: 'Sub-Space:',
|
||||||
value: deviceInfo.subspace.subspaceName,
|
value: deviceInfo.subspace.subspaceName,
|
||||||
valueColor: ColorsManager.textGray,
|
valueColor: ColorsManager.blackColor,
|
||||||
trailing: const Icon(
|
trailing: SvgPicture.asset(
|
||||||
Icons.arrow_forward_ios,
|
Assets.arrowDown,
|
||||||
size: 16,
|
width: 10,
|
||||||
color: ColorsManager.greyColor,
|
height: 10,
|
||||||
),
|
color: ColorsManager.greyColor,
|
||||||
),
|
)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Divider(color: ColorsManager.dividerColor),
|
const Divider(color: ColorsManager.dividerColor),
|
||||||
@ -104,7 +107,7 @@ class DeviceManagementContent extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: const Icon(
|
child: const Icon(
|
||||||
Icons.copy,
|
Icons.copy,
|
||||||
size: 16,
|
size: 15,
|
||||||
color: ColorsManager.greyColor,
|
color: ColorsManager.greyColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -51,8 +51,7 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
Container(
|
Container(
|
||||||
width: MediaQuery.of(context).size.width * 0.3,
|
width: MediaQuery.of(context).size.width * 0.3,
|
||||||
color: ColorsManager.grey25,
|
color: ColorsManager.grey25,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.all(10),
|
||||||
horizontal: 20, vertical: 24),
|
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
@ -70,37 +69,43 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'Device Settings',
|
'Device Settings',
|
||||||
style:
|
style: context.theme.textTheme.titleLarge!
|
||||||
context.theme.textTheme.titleLarge!.copyWith(
|
.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.w700,
|
||||||
color: ColorsManager.primaryColor,
|
color: ColorsManager.vividBlue
|
||||||
),
|
.withOpacity(0.7),
|
||||||
|
fontSize: 24),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
DefaultContainer(
|
DefaultContainer(
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
CircleAvatar(
|
Padding(
|
||||||
radius: 40,
|
padding: const EdgeInsets.only(left: 15),
|
||||||
backgroundColor:
|
|
||||||
const Color.fromARGB(177, 213, 213, 213),
|
|
||||||
child: CircleAvatar(
|
child: CircleAvatar(
|
||||||
backgroundColor: ColorsManager.whiteColors,
|
radius: 38,
|
||||||
radius: 36,
|
backgroundColor:
|
||||||
child: SvgPicture.asset(
|
ColorsManager.grayBorder.withOpacity(0.5),
|
||||||
iconPath,
|
child: CircleAvatar(
|
||||||
fit: BoxFit.cover,
|
backgroundColor: ColorsManager.whiteColors,
|
||||||
|
radius: 36,
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
iconPath,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 25),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(height: 15),
|
||||||
Text(
|
Text(
|
||||||
'Device Name:',
|
'Device Name:',
|
||||||
style: context.textTheme.bodyMedium!
|
style: context.textTheme.bodyMedium!
|
||||||
@ -108,50 +113,79 @@ class DeviceSettingsPanel extends StatelessWidget {
|
|||||||
color: ColorsManager.grayColor,
|
color: ColorsManager.grayColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextFormField(
|
SizedBox(
|
||||||
maxLength: 30,
|
height: 35,
|
||||||
style: const TextStyle(
|
child: Row(
|
||||||
color: ColorsManager.blackColor,
|
children: [
|
||||||
),
|
SizedBox(
|
||||||
textAlign: TextAlign.start,
|
height: 50,
|
||||||
focusNode: _bloc.focusNode,
|
width: 190,
|
||||||
controller: _bloc.nameController,
|
child: TextFormField(
|
||||||
enabled: _bloc.editName,
|
scrollPadding: EdgeInsets.zero,
|
||||||
onFieldSubmitted: (value) {
|
maxLength: 30,
|
||||||
_bloc.add(const ChangeNameEvent(
|
style: const TextStyle(
|
||||||
value: false));
|
color: ColorsManager.blackColor,
|
||||||
},
|
fontSize: 16,
|
||||||
decoration: const InputDecoration(
|
),
|
||||||
border: InputBorder.none,
|
textAlign: TextAlign.start,
|
||||||
fillColor: Colors.white10,
|
focusNode: _bloc.focusNode,
|
||||||
counterText: '',
|
controller: _bloc.nameController,
|
||||||
|
enabled: _bloc.editName,
|
||||||
|
onFieldSubmitted: (value) {
|
||||||
|
_bloc.add(const ChangeNameEvent(
|
||||||
|
value: false));
|
||||||
|
},
|
||||||
|
decoration: InputDecoration(
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
border: InputBorder.none,
|
||||||
|
fillColor: Colors.white10,
|
||||||
|
counterText: '',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 15,
|
||||||
|
height: 25,
|
||||||
|
child: Visibility(
|
||||||
|
visible:
|
||||||
|
_bloc.editName != true,
|
||||||
|
replacement: const SizedBox(),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
_bloc.add(
|
||||||
|
const ChangeNameEvent(
|
||||||
|
value: true));
|
||||||
|
},
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets
|
||||||
|
.editNameIconSettings,
|
||||||
|
color: ColorsManager
|
||||||
|
.lightGrayBorderColor,
|
||||||
|
height: 15,
|
||||||
|
width: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
|
||||||
Visibility(
|
|
||||||
visible: _bloc.editName != true,
|
|
||||||
replacement: const SizedBox(),
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
_bloc.add(
|
|
||||||
const ChangeNameEvent(value: true));
|
|
||||||
},
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
Assets.editNameIconSettings,
|
|
||||||
color: ColorsManager.grayColor,
|
|
||||||
height: 20,
|
|
||||||
width: 20,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
Text('Device Management', style: sectionTitle),
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 10),
|
||||||
|
child: Text('Device Management', style: sectionTitle),
|
||||||
|
),
|
||||||
DeviceManagementContent(
|
DeviceManagementContent(
|
||||||
device: device,
|
device: device,
|
||||||
subSpaces: subSpaces.cast<SubSpaceModel>(),
|
subSpaces: subSpaces.cast<SubSpaceModel>(),
|
||||||
|
|||||||
@ -491,6 +491,12 @@ class SpaceManagementBloc
|
|||||||
event.communityUuid,
|
event.communityUuid,
|
||||||
emit,
|
emit,
|
||||||
);
|
);
|
||||||
|
event.spaces.removeWhere(
|
||||||
|
(space) => space.status == SpaceStatus.deleted,
|
||||||
|
);
|
||||||
|
event.spaces.forEach(
|
||||||
|
(space) => space.status = SpaceStatus.unchanged,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// emit(SpaceManagementError('Error saving spaces: $e'));
|
// emit(SpaceManagementError('Error saving spaces: $e'));
|
||||||
|
|||||||
@ -171,4 +171,13 @@ extension SpaceExtensions on SpaceModel {
|
|||||||
|
|
||||||
return tagValues;
|
return tagValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isNoChangesSubmited(String name, icon, SpaceTemplateModel? spaceModel,
|
||||||
|
List<SubspaceModel>? subspaces, List<Tag>? tags) {
|
||||||
|
return (name == this.name &&
|
||||||
|
icon == this.icon &&
|
||||||
|
spaceModel == this.spaceModel &&
|
||||||
|
subspaces == this.subspaces &&
|
||||||
|
tags == this.tags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -384,6 +384,15 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
|
|||||||
SpaceTemplateModel? spaceModel,
|
SpaceTemplateModel? spaceModel,
|
||||||
List<SubspaceModel>? subspaces,
|
List<SubspaceModel>? subspaces,
|
||||||
List<Tag>? tags) {
|
List<Tag>? tags) {
|
||||||
|
if (widget.selectedSpace!.isNoChangesSubmited(
|
||||||
|
name,
|
||||||
|
icon,
|
||||||
|
spaceModel,
|
||||||
|
subspaces,
|
||||||
|
tags,
|
||||||
|
)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
// Update the space's properties
|
// Update the space's properties
|
||||||
widget.selectedSpace!.name = name;
|
widget.selectedSpace!.name = name;
|
||||||
|
|||||||
@ -302,13 +302,6 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
? enteredName
|
? enteredName
|
||||||
: (widget.name ?? '');
|
: (widget.name ?? '');
|
||||||
if (newName.isNotEmpty) {
|
if (newName.isNotEmpty) {
|
||||||
if (tags != null && tags!.isNotEmpty) {
|
|
||||||
if (tags!.any(
|
|
||||||
(tag) => tag.uuid == null || tag.uuid!.isEmpty,
|
|
||||||
)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
widget.onCreateSpace(
|
widget.onCreateSpace(
|
||||||
newName,
|
newName,
|
||||||
selectedIcon,
|
selectedIcon,
|
||||||
|
|||||||
@ -30,11 +30,14 @@ class CenterBodyWidget extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: state is CommunityStructureState ||
|
||||||
context
|
state is CommunitySelectedState
|
||||||
.read<CenterBodyBloc>()
|
? null
|
||||||
.add(CommunityStructureSelectedEvent());
|
: () {
|
||||||
},
|
context
|
||||||
|
.read<CenterBodyBloc>()
|
||||||
|
.add(CommunityStructureSelectedEvent());
|
||||||
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Community Structure',
|
'Community Structure',
|
||||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import shared_preferences_foundation
|
|||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FLTFirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAnalyticsPlugin"))
|
FirebaseAnalyticsPlugin.register(with: registry.registrar(forPlugin: "FirebaseAnalyticsPlugin"))
|
||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||||
FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin"))
|
FLTFirebaseCrashlyticsPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCrashlyticsPlugin"))
|
||||||
FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin"))
|
FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin"))
|
||||||
|
|||||||
@ -69,12 +69,7 @@ dev_dependencies:
|
|||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# The "flutter_lints" package below contains a set of recommended lints to
|
very_good_analysis: ^9.0.0
|
||||||
# encourage good coding practices. The lint set provided by the package is
|
|
||||||
# activated in the `analysis_options.yaml` file located at the root of your
|
|
||||||
# package. See that file for information about deactivating specific lint
|
|
||||||
# rules and activating additional ones.
|
|
||||||
flutter_lints: ^5.0.0
|
|
||||||
|
|
||||||
# For information on the generic Dart part of this file, see the
|
# For information on the generic Dart part of this file, see the
|
||||||
# following page: https://dart.dev/tools/pub/pubspec
|
# following page: https://dart.dev/tools/pub/pubspec
|
||||||
|
|||||||
Reference in New Issue
Block a user