Skip to content

Commit 85c831c

Browse files
authored
Merge pull request #32 from Onix-Systems/dev
Dev
2 parents 52f2987 + 047f3c4 commit 85c831c

File tree

37 files changed

+1902
-480
lines changed

37 files changed

+1902
-480
lines changed

bricks/flutter_clean_base/__brick__/{{project_name.snakeCase()}}/lib/presentation/widgets/actions/app_standard_button.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AppStandardButton extends StatelessWidget {
4040
onPressed: enabled ? onPressed : null,
4141
child: Text(
4242
value,
43-
style: context.appTextStyles.button,
43+
style: context.appTextStyles.text,
4444
)),
4545
);
4646
}

lib/core/app/app_consts.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,9 @@ class AppConsts {
1212
'https://apple.stackexchange.com/questions/48502/how-can-i-permanently-add-my-ssh-private-key-to-keychain-so-it-is-automatically/250572#250572';
1313

1414
static const String figmaBaseUrl = 'https://api.figma.com/v1';
15+
16+
static const String figmaStylesFirstCharValidChars =
17+
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
18+
19+
static const String figmaStylesValidChars = signingKeyPassChars;
1520
}

lib/core/app/localization/generated/intl/messages_en.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ class MessageLookup extends MessageLookupByLibrary {
9090
"exitLabel": MessageLookupByLibrary.simpleMessage("Exit"),
9191
"fields": MessageLookupByLibrary.simpleMessage("Fields"),
9292
"figmaFileKey": MessageLookupByLibrary.simpleMessage("Figma file key"),
93+
"figmaGetStylesEmpty": MessageLookupByLibrary.simpleMessage(
94+
"No styles found in this file"),
95+
"figmaGetStylesEmptyFileId":
96+
MessageLookupByLibrary.simpleMessage("Figma file id is empty"),
97+
"figmaGetStylesEmptyToken":
98+
MessageLookupByLibrary.simpleMessage("Figma token is empty"),
99+
"figmaGetStylesError": MessageLookupByLibrary.simpleMessage(
100+
"Error loading styles: check internet connection, figma file id and token"),
93101
"figmaToken": MessageLookupByLibrary.simpleMessage("Figma token"),
94102
"firebaseAuth": MessageLookupByLibrary.simpleMessage(
95103
"Integrate Firebase with FirebaseAuth?"),

lib/core/app/localization/generated/intl/messages_uk.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ class MessageLookup extends MessageLookupByLibrary {
9393
"fields": MessageLookupByLibrary.simpleMessage("Поля"),
9494
"figmaFileKey":
9595
MessageLookupByLibrary.simpleMessage("Ключ файлу Figma"),
96+
"figmaGetStylesEmpty": MessageLookupByLibrary.simpleMessage(
97+
"В цьому figma файлі не знайдено стилів"),
98+
"figmaGetStylesEmptyFileId":
99+
MessageLookupByLibrary.simpleMessage("Figma id пустий"),
100+
"figmaGetStylesEmptyToken":
101+
MessageLookupByLibrary.simpleMessage("Figma token пустий"),
102+
"figmaGetStylesError": MessageLookupByLibrary.simpleMessage(
103+
"Помилка завантаження стилів: перевірте інтернет з\'єднання, id figma файлу та токен"),
96104
"figmaToken": MessageLookupByLibrary.simpleMessage("Токен Figma"),
97105
"firstLastName":
98106
MessageLookupByLibrary.simpleMessage(" Ім\'я та прізвище"),

lib/core/app/localization/generated/l10n.dart

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/app/localization/l10n/intl_en.arb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,9 @@
113113
"dataComponentExistsInSource": " in {sourceName} source",
114114
"getStylesFromFigma": "Get styles from Figma",
115115
"figmaFileKey": "Figma file key",
116-
"figmaToken": "Figma token"
116+
"figmaToken": "Figma token",
117+
"figmaGetStylesError": "Error loading styles: check internet connection, figma file id and token",
118+
"figmaGetStylesEmpty": "No styles found in this file",
119+
"figmaGetStylesEmptyFileId": "Figma file id is empty",
120+
"figmaGetStylesEmptyToken": "Figma token is empty"
117121
}

lib/core/app/localization/l10n/intl_uk.arb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,9 @@
111111
"dataComponentExistsInSource": " в джерелі {sourceName}",
112112
"getStylesFromFigma": "Отримати стилі з Figma",
113113
"figmaFileKey": "Ключ файлу Figma",
114-
"figmaToken": "Токен Figma"
114+
"figmaToken": "Токен Figma",
115+
"figmaGetStylesError": "Помилка завантаження стилів: перевірте інтернет з'єднання, id figma файлу та токен",
116+
"figmaGetStylesEmpty": "В цьому figma файлі не знайдено стилів",
117+
"figmaGetStylesEmptyFileId": "Figma id пустий",
118+
"figmaGetStylesEmptyToken": "Figma token пустий"
115119
}

lib/core/di/bloc.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:get_it/get_it.dart';
22
import 'package:onix_flutter_bricks/app/bloc/app_bloc_imports.dart';
3+
import 'package:onix_flutter_bricks/presentation/screen/figma_styles_screen/bloc/figma_styles_screen_bloc.dart';
34
import 'package:onix_flutter_bricks/presentation/screen/procedure_selection_screen/bloc/procedure_selection_screen_bloc.dart';
45
import 'package:onix_flutter_bricks/presentation/screen/splash_screen/bloc/splash_screen_bloc.dart';
56
import 'package:onix_flutter_bricks/presentation/screen/project_name_screen/bloc/project_name_screen_bloc.dart';
@@ -22,6 +23,7 @@ void registerBloc(GetIt getIt) {
2223
..registerFactory<DataComponentsScreenBloc>(DataComponentsScreenBloc.new)
2324
..registerFactory<FieldsDialogBloc>(FieldsDialogBloc.new)
2425
..registerFactory<ScreensScreenBloc>(ScreensScreenBloc.new)
26+
..registerFactory<FigmaStylesScreenBloc>(FigmaStylesScreenBloc.new)
2527
..registerFactory<ProjectSettingsScreenBloc>(ProjectSettingsScreenBloc.new)
2628
..registerFactory<PlatformsScreenBloc>(PlatformsScreenBloc.new)
2729
..registerFactory<ProjectNameScreenBloc>(ProjectNameScreenBloc.new)

lib/core/router/app_router.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@formatter:off
22
import 'package:go_router/go_router.dart';
33
import 'package:onix_flutter_bricks/domain/entity/config/config.dart';
4+
import 'package:onix_flutter_bricks/presentation/screen/figma_styles_screen/figma_styles_screen.dart';
45
import 'package:onix_flutter_bricks/presentation/screen/splash_screen/splash_screen.dart';
56
import 'package:onix_flutter_bricks/presentation/screen/project_name_screen/project_name_screen.dart';
67
import 'package:onix_flutter_bricks/presentation/screen/procedure_selection_screen/procedure_selection_screen.dart';
@@ -22,6 +23,7 @@ class AppRouter {
2223
static const _platformsScreen = '/platforms';
2324
static const _projectSettingsScreen = '/project_settings';
2425
static const _screensScreen = '/screens';
26+
static const _stylesScreen = '/styles';
2527
static const _dataComponentsScreen = '/data_components';
2628
static const _swaggerParserScreen = '/swagger_parser';
2729
static const _summaryScreen = '/summary';
@@ -38,6 +40,7 @@ class AppRouter {
3840
static String get platformsScreen => _platformsScreen;
3941
static String get projectSettingsScreen => _projectSettingsScreen;
4042
static String get screensScreen => _screensScreen;
43+
static String get stylesScreen => _stylesScreen;
4144
static String get dataComponentsScreen => _dataComponentsScreen;
4245
static String get swaggerParserScreen => _swaggerParserScreen;
4346
static String get summaryScreen => _summaryScreen;
@@ -97,6 +100,13 @@ class AppRouter {
97100
config: state.extra as Config,
98101
),
99102
),
103+
GoRoute(
104+
path: _stylesScreen,
105+
name: 'StylesScreen',
106+
builder: (context, state) => FigmaStylesScreen(
107+
config: state.extra as Config,
108+
),
109+
),
100110
GoRoute(
101111
path: _dataComponentsScreen,
102112
name: 'DataComponentsScreen',
Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,44 @@
1+
import 'package:onix_flutter_bricks/core/app/app_consts.dart';
2+
import 'package:recase/recase.dart';
3+
14
abstract class AppStyle {
25
final String id;
3-
final String name;
6+
String name;
47

58
AppStyle({
69
required this.id,
710
required this.name,
811
});
12+
13+
bool validate() {
14+
bool valid = true;
15+
var newName = name;
16+
17+
if (!AppConsts.figmaStylesFirstCharValidChars
18+
.contains(name.split('').first)) {
19+
newName = 'style $newName';
20+
}
21+
22+
if (name
23+
.split('')
24+
.any((element) => !AppConsts.figmaStylesValidChars.contains(element))) {
25+
for (var i = 0; i < name.length; i++) {
26+
if (!AppConsts.figmaStylesValidChars.contains(name[i])) {
27+
newName = newName.replaceFirst(name[i], ' ');
28+
}
29+
}
30+
}
31+
32+
newName = newName.trim().replaceAll(RegExp(r'\s+|\s'), ' ');
33+
34+
if (newName == 'style' ||
35+
newName == 'style Dark' ||
36+
newName == 'style Light') {
37+
valid = false;
38+
} else {
39+
name = newName.camelCase;
40+
}
41+
42+
return valid;
43+
}
944
}

0 commit comments

Comments
 (0)