wlmaker 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +156 -343
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -167,10 +167,10 @@ import { pascalCase as pascalCase2 } from "change-case";
|
|
|
167
167
|
// src/core/tier.ts
|
|
168
168
|
var VALID_TIERS = ["atom", "molecule", "organism", "template"];
|
|
169
169
|
var TIER_PATTERNS = {
|
|
170
|
-
atom: ["single-public", "single-factory"
|
|
170
|
+
atom: ["single-public", "single-factory"],
|
|
171
171
|
molecule: ["single", "subdirectory-parts", "subdirectory-widgets"],
|
|
172
172
|
organism: ["subdirectory-show", "single"],
|
|
173
|
-
template: ["simple"
|
|
173
|
+
template: ["simple"]
|
|
174
174
|
};
|
|
175
175
|
var TIER_PLURAL = {
|
|
176
176
|
atom: "atoms",
|
|
@@ -188,11 +188,10 @@ var PATTERN_LABELS = {
|
|
|
188
188
|
"single-public": "Single file, public constructor",
|
|
189
189
|
"single-factory": "Single file, private constructor + factories",
|
|
190
190
|
"subdirectory-parts": "Subdirectory with part files",
|
|
191
|
-
single: "Single file
|
|
191
|
+
single: "Single file",
|
|
192
192
|
"subdirectory-widgets": "Subdirectory with widgets/ and utils/",
|
|
193
|
-
"subdirectory-show": "Subdirectory with
|
|
194
|
-
simple: "Template simple (i18n +
|
|
195
|
-
"config-data-callbacks": "Template with Config/Data/Callbacks"
|
|
193
|
+
"subdirectory-show": "Subdirectory with factories + variant/i18n/skeleton parts",
|
|
194
|
+
simple: "Template simple (i18n + skeleton)"
|
|
196
195
|
};
|
|
197
196
|
function normalizeTier(input) {
|
|
198
197
|
const normalized = input.toLowerCase().replace(/s$/, "");
|
|
@@ -390,12 +389,20 @@ import 'package:flutter/material.dart';
|
|
|
390
389
|
class Wl${pascal} extends StatelessWidget {
|
|
391
390
|
const Wl${pascal}({super.key});
|
|
392
391
|
|
|
392
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
393
|
+
|
|
393
394
|
@override
|
|
394
395
|
Widget build(BuildContext context) {
|
|
395
396
|
final theme = context.theme;
|
|
396
397
|
return const SizedBox.shrink();
|
|
397
398
|
}
|
|
398
399
|
}
|
|
400
|
+
|
|
401
|
+
class _Wl${pascal}SkeletonFactory {
|
|
402
|
+
const _Wl${pascal}SkeletonFactory();
|
|
403
|
+
|
|
404
|
+
Widget call({Key? key}) => const SizedBox.shrink();
|
|
405
|
+
}
|
|
399
406
|
`;
|
|
400
407
|
}
|
|
401
408
|
function atomTemplateB(name, pascal) {
|
|
@@ -418,60 +425,21 @@ class Wl${pascal} extends StatelessWidget {
|
|
|
418
425
|
factory Wl${pascal}.secondary({Key? key}) =>
|
|
419
426
|
Wl${pascal}._internal(variant: Wl${pascal}Variant.secondary, key: key);
|
|
420
427
|
|
|
421
|
-
|
|
422
|
-
Widget build(BuildContext context) {
|
|
423
|
-
final theme = context.theme;
|
|
424
|
-
return const SizedBox.shrink();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
`;
|
|
428
|
-
}
|
|
429
|
-
function atomTemplateC(name, pascal) {
|
|
430
|
-
return {
|
|
431
|
-
main: `import 'package:design_system/design_system.dart';
|
|
432
|
-
import 'package:flutter/material.dart';
|
|
433
|
-
|
|
434
|
-
part '${name}_sizes.dart';
|
|
435
|
-
|
|
436
|
-
class Wl${pascal} extends StatelessWidget {
|
|
437
|
-
final Wl${pascal}Size size;
|
|
438
|
-
|
|
439
|
-
const Wl${pascal}({this.size = Wl${pascal}Size.md, super.key});
|
|
428
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
440
429
|
|
|
441
430
|
@override
|
|
442
431
|
Widget build(BuildContext context) {
|
|
443
432
|
final theme = context.theme;
|
|
444
|
-
return SizedBox(
|
|
445
|
-
width: size.width,
|
|
446
|
-
height: size.height,
|
|
447
|
-
child: const SizedBox.shrink(),
|
|
448
|
-
);
|
|
433
|
+
return const SizedBox.shrink();
|
|
449
434
|
}
|
|
450
435
|
}
|
|
451
|
-
`,
|
|
452
|
-
sizes: `part of '${name}.dart';
|
|
453
|
-
|
|
454
|
-
enum _Wl${pascal}Size {
|
|
455
|
-
sm,
|
|
456
|
-
md,
|
|
457
|
-
lg,
|
|
458
|
-
}
|
|
459
436
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
_Wl${pascal}Size.sm => 16,
|
|
463
|
-
_Wl${pascal}Size.md => 24,
|
|
464
|
-
_Wl${pascal}Size.lg => 32,
|
|
465
|
-
};
|
|
437
|
+
class _Wl${pascal}SkeletonFactory {
|
|
438
|
+
const _Wl${pascal}SkeletonFactory();
|
|
466
439
|
|
|
467
|
-
|
|
468
|
-
_Wl${pascal}Size.sm => 16,
|
|
469
|
-
_Wl${pascal}Size.md => 24,
|
|
470
|
-
_Wl${pascal}Size.lg => 32,
|
|
471
|
-
};
|
|
440
|
+
Widget call({Key? key}) => const SizedBox.shrink();
|
|
472
441
|
}
|
|
473
|
-
|
|
474
|
-
};
|
|
442
|
+
`;
|
|
475
443
|
}
|
|
476
444
|
function moleculeTemplateA(name, pascal) {
|
|
477
445
|
return `import 'package:design_system/design_system.dart';
|
|
@@ -482,7 +450,7 @@ enum Wl${pascal}Variant {
|
|
|
482
450
|
secondary,
|
|
483
451
|
}
|
|
484
452
|
|
|
485
|
-
class Wl${pascal} extends
|
|
453
|
+
class Wl${pascal} extends StatelessWidget {
|
|
486
454
|
final Wl${pascal}Variant variant;
|
|
487
455
|
|
|
488
456
|
const Wl${pascal}({
|
|
@@ -490,16 +458,19 @@ class Wl${pascal} extends StatefulWidget {
|
|
|
490
458
|
super.key,
|
|
491
459
|
});
|
|
492
460
|
|
|
493
|
-
@override
|
|
494
|
-
State<Wl${pascal}> createState() => _Wl${pascal}State();
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
class _Wl${pascal}State extends State<Wl${pascal}> {
|
|
498
461
|
@override
|
|
499
462
|
Widget build(BuildContext context) {
|
|
500
463
|
final theme = context.theme;
|
|
501
464
|
return const SizedBox.shrink();
|
|
502
465
|
}
|
|
466
|
+
|
|
467
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
class _Wl${pascal}SkeletonFactory {
|
|
471
|
+
const _Wl${pascal}SkeletonFactory();
|
|
472
|
+
|
|
473
|
+
Widget call({Key? key}) => const SizedBox.shrink();
|
|
503
474
|
}
|
|
504
475
|
`;
|
|
505
476
|
}
|
|
@@ -508,9 +479,9 @@ function moleculeTemplateB(name, pascal) {
|
|
|
508
479
|
main: `import 'package:design_system/design_system.dart';
|
|
509
480
|
import 'package:flutter/material.dart';
|
|
510
481
|
|
|
511
|
-
part '${name}_type.dart';
|
|
482
|
+
part 'wl_${name}_type.dart';
|
|
512
483
|
|
|
513
|
-
class Wl${pascal} extends
|
|
484
|
+
class Wl${pascal} extends StatelessWidget {
|
|
514
485
|
final Wl${pascal}Variant variant;
|
|
515
486
|
|
|
516
487
|
const Wl${pascal}({
|
|
@@ -518,19 +489,22 @@ class Wl${pascal} extends StatefulWidget {
|
|
|
518
489
|
super.key,
|
|
519
490
|
});
|
|
520
491
|
|
|
521
|
-
@override
|
|
522
|
-
State<Wl${pascal}> createState() => _Wl${pascal}State();
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
class _Wl${pascal}State extends State<Wl${pascal}> {
|
|
526
492
|
@override
|
|
527
493
|
Widget build(BuildContext context) {
|
|
528
494
|
final theme = context.theme;
|
|
529
495
|
return const SizedBox.shrink();
|
|
530
496
|
}
|
|
497
|
+
|
|
498
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
class _Wl${pascal}SkeletonFactory {
|
|
502
|
+
const _Wl${pascal}SkeletonFactory();
|
|
503
|
+
|
|
504
|
+
Widget call({Key? key}) => const SizedBox.shrink();
|
|
531
505
|
}
|
|
532
506
|
`,
|
|
533
|
-
type: `part of '${name}.dart';
|
|
507
|
+
type: `part of 'wl_${name}.dart';
|
|
534
508
|
|
|
535
509
|
enum Wl${pascal}Variant {
|
|
536
510
|
primary,
|
|
@@ -547,19 +521,22 @@ function moleculeTemplateC(name, pascal) {
|
|
|
547
521
|
return `import 'package:design_system/design_system.dart';
|
|
548
522
|
import 'package:flutter/material.dart';
|
|
549
523
|
|
|
550
|
-
class Wl${pascal} extends
|
|
524
|
+
class Wl${pascal} extends StatelessWidget {
|
|
551
525
|
const Wl${pascal}({super.key});
|
|
552
526
|
|
|
553
|
-
@override
|
|
554
|
-
State<Wl${pascal}> createState() => _Wl${pascal}State();
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
class _Wl${pascal}State extends State<Wl${pascal}> {
|
|
558
527
|
@override
|
|
559
528
|
Widget build(BuildContext context) {
|
|
560
529
|
final theme = context.theme;
|
|
561
530
|
return const SizedBox.shrink();
|
|
562
531
|
}
|
|
532
|
+
|
|
533
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
class _Wl${pascal}SkeletonFactory {
|
|
537
|
+
const _Wl${pascal}SkeletonFactory();
|
|
538
|
+
|
|
539
|
+
Widget call({Key? key}) => const SizedBox.shrink();
|
|
563
540
|
}
|
|
564
541
|
`;
|
|
565
542
|
}
|
|
@@ -568,279 +545,159 @@ function organismTemplateA(name, pascal) {
|
|
|
568
545
|
main: `import 'package:design_system/design_system.dart';
|
|
569
546
|
import 'package:flutter/material.dart';
|
|
570
547
|
|
|
571
|
-
part '${name}
|
|
548
|
+
part 'wl_${name}_variant.dart';
|
|
549
|
+
part 'wl_${name}_i18n.dart';
|
|
550
|
+
part 'wl_${name}_skeleton.dart';
|
|
572
551
|
|
|
573
|
-
class Wl${pascal} {
|
|
574
|
-
Wl${pascal}
|
|
552
|
+
class Wl${pascal} extends StatelessWidget {
|
|
553
|
+
final Wl${pascal}Variant variant;
|
|
554
|
+
final Wl${pascal}I18n i18n;
|
|
575
555
|
|
|
576
|
-
|
|
577
|
-
required
|
|
556
|
+
factory Wl${pascal}({
|
|
557
|
+
required Wl${pascal}I18n i18n,
|
|
558
|
+
Key? key,
|
|
578
559
|
}) {
|
|
579
|
-
return
|
|
580
|
-
|
|
581
|
-
|
|
560
|
+
return Wl${pascal}._(
|
|
561
|
+
key: key,
|
|
562
|
+
variant: Wl${pascal}Variant.primary,
|
|
563
|
+
i18n: i18n,
|
|
582
564
|
);
|
|
583
565
|
}
|
|
584
|
-
}
|
|
585
|
-
`,
|
|
586
|
-
content: `part of '${name}.dart';
|
|
587
566
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
return
|
|
567
|
+
factory Wl${pascal}.secondary({
|
|
568
|
+
required Wl${pascal}I18n i18n,
|
|
569
|
+
Key? key,
|
|
570
|
+
}) {
|
|
571
|
+
return Wl${pascal}._(
|
|
572
|
+
key: key,
|
|
573
|
+
variant: Wl${pascal}Variant.secondary,
|
|
574
|
+
i18n: i18n,
|
|
575
|
+
);
|
|
593
576
|
}
|
|
594
|
-
}
|
|
595
|
-
`
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
function organismTemplateB(name, pascal) {
|
|
599
|
-
return `import 'package:design_system/design_system.dart';
|
|
600
|
-
import 'package:flutter/material.dart';
|
|
601
577
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
578
|
+
const Wl${pascal}._({
|
|
579
|
+
required this.variant,
|
|
580
|
+
required this.i18n,
|
|
581
|
+
super.key,
|
|
582
|
+
});
|
|
608
583
|
|
|
609
|
-
class _Wl${pascal}State extends State<Wl${pascal}> {
|
|
610
584
|
@override
|
|
611
585
|
Widget build(BuildContext context) {
|
|
612
586
|
final theme = context.theme;
|
|
613
587
|
return const SizedBox.shrink();
|
|
614
588
|
}
|
|
615
589
|
}
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
function templateA(name, pascal) {
|
|
619
|
-
return {
|
|
620
|
-
main: `import 'package:design_system/design_system.dart';
|
|
621
|
-
import 'package:flutter/material.dart';
|
|
622
|
-
|
|
623
|
-
part '${name}_i18n.dart';
|
|
624
|
-
part '${name}_body.dart';
|
|
625
|
-
part '${name}_skeleton.dart';
|
|
626
|
-
|
|
627
|
-
class Wl${pascal}Template extends StatefulWidget {
|
|
628
|
-
const Wl${pascal}Template({super.key});
|
|
629
|
-
|
|
630
|
-
@override
|
|
631
|
-
State<Wl${pascal}Template> createState() => _Wl${pascal}TemplateState();
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
class _Wl${pascal}TemplateState extends State<Wl${pascal}Template> {
|
|
635
|
-
bool _isLoading = true;
|
|
636
|
-
|
|
637
|
-
@override
|
|
638
|
-
void initState() {
|
|
639
|
-
super.initState();
|
|
640
|
-
_loadData();
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
Future<void> _loadData() async {
|
|
644
|
-
// TODO: Load data
|
|
645
|
-
setState(() => _isLoading = false);
|
|
646
|
-
}
|
|
590
|
+
`,
|
|
591
|
+
variant: `part of 'wl_${name}.dart';
|
|
647
592
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
appBar: AppBar(title: Text(Wl${pascal}I18n.title)),
|
|
652
|
-
body: AnimatedSwitcher(
|
|
653
|
-
duration: const Duration(milliseconds: 300),
|
|
654
|
-
child: _isLoading
|
|
655
|
-
? const _Wl${pascal}Skeleton()
|
|
656
|
-
: const _Wl${pascal}Body(),
|
|
657
|
-
),
|
|
658
|
-
);
|
|
659
|
-
}
|
|
593
|
+
enum Wl${pascal}Variant {
|
|
594
|
+
primary,
|
|
595
|
+
secondary,
|
|
660
596
|
}
|
|
661
597
|
`,
|
|
662
|
-
i18n: `part of '${name}
|
|
663
|
-
|
|
664
|
-
class Wl${pascal}I18n extends Equatable {
|
|
665
|
-
final String title;
|
|
598
|
+
i18n: `part of 'wl_${name}.dart';
|
|
666
599
|
|
|
600
|
+
class Wl${pascal}I18n {
|
|
667
601
|
const Wl${pascal}I18n({
|
|
668
602
|
this.title = '',
|
|
603
|
+
this.subtitle = '',
|
|
669
604
|
});
|
|
670
605
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
@override
|
|
674
|
-
List<Object?> get props => [title];
|
|
606
|
+
final String title;
|
|
607
|
+
final String subtitle;
|
|
675
608
|
}
|
|
676
609
|
`,
|
|
677
|
-
|
|
610
|
+
skeleton: `part of 'wl_${name}.dart';
|
|
678
611
|
|
|
679
|
-
class
|
|
680
|
-
const
|
|
612
|
+
class Wl${pascal}Skeleton extends StatelessWidget {
|
|
613
|
+
const Wl${pascal}Skeleton({super.key});
|
|
681
614
|
|
|
682
615
|
@override
|
|
683
616
|
Widget build(BuildContext context) {
|
|
684
617
|
final theme = context.theme;
|
|
685
|
-
return const SizedBox.shrink();
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
`,
|
|
689
|
-
skeleton: `part of '${name}_template.dart';
|
|
690
618
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
Widget build(BuildContext context) {
|
|
696
|
-
return const Center(
|
|
697
|
-
child: CircularProgressIndicator(),
|
|
619
|
+
return WlSkeleton(
|
|
620
|
+
width: double.infinity,
|
|
621
|
+
height: 120,
|
|
622
|
+
radius: theme.borderRadius.radiusL,
|
|
698
623
|
);
|
|
699
624
|
}
|
|
700
625
|
}
|
|
701
626
|
`
|
|
702
627
|
};
|
|
703
628
|
}
|
|
704
|
-
function
|
|
705
|
-
return
|
|
706
|
-
main: `import 'package:design_system/design_system.dart';
|
|
629
|
+
function organismTemplateB(name, pascal) {
|
|
630
|
+
return `import 'package:design_system/design_system.dart';
|
|
707
631
|
import 'package:flutter/material.dart';
|
|
708
632
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
import 'contracts/${name}_data.dart';
|
|
712
|
-
|
|
713
|
-
part '${name}_i18n.dart';
|
|
714
|
-
part '${name}_body.dart';
|
|
715
|
-
part '${name}_skeleton.dart';
|
|
716
|
-
|
|
717
|
-
class Wl${pascal}Template extends StatefulWidget {
|
|
718
|
-
final Wl${pascal}Config config;
|
|
719
|
-
final Wl${pascal}Callbacks callbacks;
|
|
633
|
+
class Wl${pascal} extends StatefulWidget {
|
|
634
|
+
const Wl${pascal}({super.key});
|
|
720
635
|
|
|
721
|
-
const
|
|
722
|
-
required this.config,
|
|
723
|
-
required this.callbacks,
|
|
724
|
-
super.key,
|
|
725
|
-
});
|
|
636
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
726
637
|
|
|
727
638
|
@override
|
|
728
|
-
State<Wl${pascal}
|
|
639
|
+
State<Wl${pascal}> createState() => _Wl${pascal}State();
|
|
729
640
|
}
|
|
730
641
|
|
|
731
|
-
class _Wl${pascal}
|
|
732
|
-
Wl${pascal}Data _data = const Wl${pascal}Data();
|
|
733
|
-
bool _isLoading = true;
|
|
734
|
-
|
|
735
|
-
@override
|
|
736
|
-
void initState() {
|
|
737
|
-
super.initState();
|
|
738
|
-
_loadData();
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
Future<void> _loadData() async {
|
|
742
|
-
// TODO: Load data
|
|
743
|
-
setState(() => _isLoading = false);
|
|
744
|
-
}
|
|
745
|
-
|
|
642
|
+
class _Wl${pascal}State extends State<Wl${pascal}> {
|
|
746
643
|
@override
|
|
747
644
|
Widget build(BuildContext context) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
body: AnimatedSwitcher(
|
|
751
|
-
duration: const Duration(milliseconds: 300),
|
|
752
|
-
child: _isLoading
|
|
753
|
-
? const _Wl${pascal}Skeleton()
|
|
754
|
-
: _Wl${pascal}Body(
|
|
755
|
-
data: _data,
|
|
756
|
-
callbacks: widget.callbacks,
|
|
757
|
-
),
|
|
758
|
-
),
|
|
759
|
-
);
|
|
645
|
+
final theme = context.theme;
|
|
646
|
+
return const SizedBox.shrink();
|
|
760
647
|
}
|
|
761
648
|
}
|
|
762
|
-
`,
|
|
763
|
-
i18n: `part of '${name}_template.dart';
|
|
764
649
|
|
|
765
|
-
class
|
|
766
|
-
|
|
650
|
+
class _Wl${pascal}SkeletonFactory {
|
|
651
|
+
const _Wl${pascal}SkeletonFactory();
|
|
767
652
|
|
|
768
|
-
|
|
769
|
-
this.title = '',
|
|
770
|
-
});
|
|
771
|
-
|
|
772
|
-
static const empty = Wl${pascal}I18n();
|
|
773
|
-
|
|
774
|
-
@override
|
|
775
|
-
List<Object?> get props => [title];
|
|
653
|
+
Widget call({Key? key}) => const SizedBox.shrink();
|
|
776
654
|
}
|
|
777
|
-
|
|
778
|
-
|
|
655
|
+
`;
|
|
656
|
+
}
|
|
657
|
+
function templateA(name, pascal) {
|
|
658
|
+
return {
|
|
659
|
+
main: `import 'package:design_system/design_system.dart';
|
|
660
|
+
import 'package:flutter/material.dart';
|
|
779
661
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
final Wl${pascal}Callbacks callbacks;
|
|
662
|
+
part 'wl_${name}_i18n.dart';
|
|
663
|
+
part 'wl_${name}_skeleton.dart';
|
|
783
664
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
required this.
|
|
665
|
+
class Wl${pascal}Template extends StatelessWidget {
|
|
666
|
+
const Wl${pascal}Template({
|
|
667
|
+
required this.i18n,
|
|
668
|
+
this.isLoading = false,
|
|
669
|
+
super.key,
|
|
787
670
|
});
|
|
788
671
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
final theme = context.theme;
|
|
792
|
-
return const SizedBox.shrink();
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
`,
|
|
796
|
-
skeleton: `part of '${name}_template.dart';
|
|
797
|
-
|
|
798
|
-
class _Wl${pascal}Skeleton extends StatelessWidget {
|
|
799
|
-
const _Wl${pascal}Skeleton();
|
|
672
|
+
final Wl${pascal}I18n i18n;
|
|
673
|
+
final bool isLoading;
|
|
800
674
|
|
|
801
675
|
@override
|
|
802
676
|
Widget build(BuildContext context) {
|
|
803
|
-
return
|
|
804
|
-
|
|
677
|
+
return Scaffold(
|
|
678
|
+
appBar: WlTopBar(title: i18n.title),
|
|
679
|
+
body: isLoading
|
|
680
|
+
? const Wl${pascal}Skeleton()
|
|
681
|
+
: const SizedBox.shrink(),
|
|
805
682
|
);
|
|
806
683
|
}
|
|
807
684
|
}
|
|
808
685
|
`,
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
class Wl${pascal}Callbacks {
|
|
812
|
-
final VoidCallback onBack;
|
|
813
|
-
final VoidCallback onRetry;
|
|
814
|
-
|
|
815
|
-
const Wl${pascal}Callbacks({
|
|
816
|
-
required this.onBack,
|
|
817
|
-
required this.onRetry,
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
`,
|
|
821
|
-
config: `import 'package:flutter/material.dart';
|
|
822
|
-
import '../${name}_template.dart';
|
|
686
|
+
i18n: `part of 'wl_${name}_template.dart';
|
|
823
687
|
|
|
824
|
-
class Wl${pascal}
|
|
825
|
-
|
|
826
|
-
final
|
|
827
|
-
|
|
828
|
-
const Wl${pascal}Config({
|
|
829
|
-
this.i18n = Wl${pascal}I18n.empty,
|
|
830
|
-
this.showAppBar = true,
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
@override
|
|
834
|
-
List<Object?> get props => [i18n, showAppBar];
|
|
688
|
+
class Wl${pascal}I18n {
|
|
689
|
+
const Wl${pascal}I18n({this.title = ''});
|
|
690
|
+
final String title;
|
|
835
691
|
}
|
|
836
692
|
`,
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
class Wl${pascal}Data extends Equatable {
|
|
840
|
-
const Wl${pascal}Data();
|
|
693
|
+
skeleton: `part of 'wl_${name}_template.dart';
|
|
841
694
|
|
|
695
|
+
class Wl${pascal}Skeleton extends StatelessWidget {
|
|
696
|
+
const Wl${pascal}Skeleton({super.key});
|
|
842
697
|
@override
|
|
843
|
-
|
|
698
|
+
Widget build(BuildContext context) {
|
|
699
|
+
return const WlSkeleton(width: double.infinity, height: 200);
|
|
700
|
+
}
|
|
844
701
|
}
|
|
845
702
|
`
|
|
846
703
|
};
|
|
@@ -909,7 +766,8 @@ async function createWidget(name, tierInput, options) {
|
|
|
909
766
|
break;
|
|
910
767
|
}
|
|
911
768
|
const barrelFileName = `${plural}.dart`;
|
|
912
|
-
const
|
|
769
|
+
const isSubdirectory = tier === "molecule" && pattern === "subdirectory-parts" || tier === "molecule" && pattern === "subdirectory-widgets" || tier === "organism" && pattern === "subdirectory-show";
|
|
770
|
+
const exportLine = tier === "template" ? `export '${cleanName}/wl_${cleanName}_template.dart';` : isSubdirectory ? `export '${fileName}/${fileName}.dart';` : `export '${fileName}.dart';`;
|
|
913
771
|
updateSortedBarrelFile(tierDir, barrelFileName, exportLine);
|
|
914
772
|
console.log(chalk2.green(`Widget "Wl${pascal}" created in ${plural}/`));
|
|
915
773
|
}
|
|
@@ -929,17 +787,6 @@ function createAtomFiles(tierDir, name, pascal, fileName, pattern) {
|
|
|
929
787
|
);
|
|
930
788
|
break;
|
|
931
789
|
}
|
|
932
|
-
case "subdirectory-parts": {
|
|
933
|
-
const dir = path6.join(tierDir, fileName);
|
|
934
|
-
fs6.mkdirSync(dir, { recursive: true });
|
|
935
|
-
const tpl = atomTemplateC(name, pascal);
|
|
936
|
-
fs6.writeFileSync(path6.join(dir, `${fileName}.dart`), tpl.main);
|
|
937
|
-
fs6.writeFileSync(
|
|
938
|
-
path6.join(dir, `${fileName}_sizes.dart`),
|
|
939
|
-
tpl.sizes
|
|
940
|
-
);
|
|
941
|
-
break;
|
|
942
|
-
}
|
|
943
790
|
default:
|
|
944
791
|
throw new Error(`Unknown atom pattern: ${pattern}`);
|
|
945
792
|
}
|
|
@@ -987,8 +834,13 @@ function createOrganismFiles(tierDir, name, pascal, fileName, pattern) {
|
|
|
987
834
|
const tpl = organismTemplateA(name, pascal);
|
|
988
835
|
fs6.writeFileSync(path6.join(dir, `${fileName}.dart`), tpl.main);
|
|
989
836
|
fs6.writeFileSync(
|
|
990
|
-
path6.join(dir, `${fileName}
|
|
991
|
-
tpl.
|
|
837
|
+
path6.join(dir, `${fileName}_variant.dart`),
|
|
838
|
+
tpl.variant
|
|
839
|
+
);
|
|
840
|
+
fs6.writeFileSync(path6.join(dir, `${fileName}_i18n.dart`), tpl.i18n);
|
|
841
|
+
fs6.writeFileSync(
|
|
842
|
+
path6.join(dir, `${fileName}_skeleton.dart`),
|
|
843
|
+
tpl.skeleton
|
|
992
844
|
);
|
|
993
845
|
break;
|
|
994
846
|
}
|
|
@@ -1006,58 +858,19 @@ function createOrganismFiles(tierDir, name, pascal, fileName, pattern) {
|
|
|
1006
858
|
function createTemplateFiles(tierDir, name, pascal, fileName, pattern) {
|
|
1007
859
|
const dir = path6.join(tierDir, name);
|
|
1008
860
|
fs6.mkdirSync(dir, { recursive: true });
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
path6.join(dir, `wl_${name}_skeleton.dart`),
|
|
1023
|
-
tpl.skeleton
|
|
1024
|
-
);
|
|
1025
|
-
break;
|
|
1026
|
-
}
|
|
1027
|
-
case "config-data-callbacks": {
|
|
1028
|
-
const tpl = templateB(name, pascal);
|
|
1029
|
-
fs6.writeFileSync(
|
|
1030
|
-
path6.join(dir, `wl_${name}_template.dart`),
|
|
1031
|
-
tpl.main
|
|
1032
|
-
);
|
|
1033
|
-
fs6.writeFileSync(
|
|
1034
|
-
path6.join(dir, `wl_${name}_i18n.dart`),
|
|
1035
|
-
tpl.i18n
|
|
1036
|
-
);
|
|
1037
|
-
fs6.writeFileSync(path6.join(dir, `wl_${name}_body.dart`), tpl.body);
|
|
1038
|
-
fs6.writeFileSync(
|
|
1039
|
-
path6.join(dir, `wl_${name}_skeleton.dart`),
|
|
1040
|
-
tpl.skeleton
|
|
1041
|
-
);
|
|
1042
|
-
const contractsDir = path6.join(dir, "contracts");
|
|
1043
|
-
fs6.mkdirSync(contractsDir, { recursive: true });
|
|
1044
|
-
fs6.writeFileSync(
|
|
1045
|
-
path6.join(contractsDir, `wl_${name}_callbacks.dart`),
|
|
1046
|
-
tpl.callbacks
|
|
1047
|
-
);
|
|
1048
|
-
fs6.writeFileSync(
|
|
1049
|
-
path6.join(contractsDir, `wl_${name}_config.dart`),
|
|
1050
|
-
tpl.config
|
|
1051
|
-
);
|
|
1052
|
-
fs6.writeFileSync(
|
|
1053
|
-
path6.join(contractsDir, `wl_${name}_data.dart`),
|
|
1054
|
-
tpl.data
|
|
1055
|
-
);
|
|
1056
|
-
break;
|
|
1057
|
-
}
|
|
1058
|
-
default:
|
|
1059
|
-
throw new Error(`Unknown template pattern: ${pattern}`);
|
|
1060
|
-
}
|
|
861
|
+
const tpl = templateA(name, pascal);
|
|
862
|
+
fs6.writeFileSync(
|
|
863
|
+
path6.join(dir, `wl_${name}_template.dart`),
|
|
864
|
+
tpl.main
|
|
865
|
+
);
|
|
866
|
+
fs6.writeFileSync(
|
|
867
|
+
path6.join(dir, `wl_${name}_i18n.dart`),
|
|
868
|
+
tpl.i18n
|
|
869
|
+
);
|
|
870
|
+
fs6.writeFileSync(
|
|
871
|
+
path6.join(dir, `wl_${name}_skeleton.dart`),
|
|
872
|
+
tpl.skeleton
|
|
873
|
+
);
|
|
1061
874
|
}
|
|
1062
875
|
|
|
1063
876
|
// src/core/create-usecase.ts
|