agent-flutter 0.1.9 → 0.1.11
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/package.json
CHANGED
|
@@ -288,6 +288,8 @@ cat >.vscode/settings.json <<'JSON'
|
|
|
288
288
|
JSON
|
|
289
289
|
|
|
290
290
|
run_fvm flutter pub add get flutter_bloc equatable dio retrofit json_annotation flutter_dotenv flutter_svg intl
|
|
291
|
+
run_fvm flutter pub add flutter_keyboard_visibility:^6.0.0 cached_network_image:^3.3.1 flutter_inappwebview:^6.1.5 pin_code_fields:^8.0.1 gif:^2.3.0
|
|
292
|
+
run_fvm flutter pub add carousel_slider:^5.1.1 smooth_page_indicator:^2.0.1
|
|
291
293
|
run_fvm flutter pub add common_widget --git-url https://github.com/tuan-urani/common_widget --git-ref main
|
|
292
294
|
run_fvm flutter pub add --dev build_runner retrofit_generator json_serializable
|
|
293
295
|
|
|
@@ -376,13 +378,192 @@ EOF
|
|
|
376
378
|
|
|
377
379
|
cat >lib/src/utils/app_colors.dart <<'EOF'
|
|
378
380
|
import 'package:flutter/material.dart';
|
|
381
|
+
import '../extensions/color_extension.dart';
|
|
379
382
|
|
|
380
383
|
class AppColors {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
static const Color
|
|
384
|
+
// ===========================================================================
|
|
385
|
+
// PRIMARY
|
|
386
|
+
// ===========================================================================
|
|
387
|
+
static const Color primary = Color(0xFF84C93F);
|
|
388
|
+
static const Color primaryLight = Color(0xFF5CC7A0);
|
|
389
|
+
|
|
390
|
+
/// Alpha variants
|
|
391
|
+
static const Color primaryAlpha10 = Color(0x1A84C93F);
|
|
392
|
+
|
|
393
|
+
// Backward compatibility
|
|
394
|
+
static const Color color84C93F = primaryAlpha10;
|
|
395
|
+
static const Color color1A84C93F = primaryAlpha10;
|
|
396
|
+
|
|
397
|
+
// ===========================================================================
|
|
398
|
+
// SECONDARY
|
|
399
|
+
// ===========================================================================
|
|
400
|
+
static const Color secondary1 = Color(0xFFCAE7B4);
|
|
401
|
+
static const Color secondary2 = Color(0xFFE6F4EC);
|
|
402
|
+
|
|
403
|
+
// ===========================================================================
|
|
404
|
+
// NEUTRAL / BLACK
|
|
405
|
+
// ===========================================================================
|
|
406
|
+
static const Color black = Color(0xFF000000);
|
|
407
|
+
|
|
408
|
+
// ===========================================================================
|
|
409
|
+
// NEUTRAL / WHITE
|
|
410
|
+
// ===========================================================================
|
|
385
411
|
static const Color white = Color(0xFFFFFFFF);
|
|
412
|
+
static const Color transparent = Color(0x00000000);
|
|
413
|
+
|
|
414
|
+
// ===========================================================================
|
|
415
|
+
// STATUS
|
|
416
|
+
// ===========================================================================
|
|
417
|
+
static const Color success = Color(0xFF4CAF50);
|
|
418
|
+
static const Color warning = Color(0xFFFFC107);
|
|
419
|
+
static const Color error = Color(0xFFF44336);
|
|
420
|
+
static const Color info = Color(0xFF2196F3);
|
|
421
|
+
|
|
422
|
+
// ===========================================================================
|
|
423
|
+
// TEXT
|
|
424
|
+
// ===========================================================================
|
|
425
|
+
static const Color textPrimary = Color(0xFF212121);
|
|
426
|
+
static const Color textDisabled = Color(0xFFC0C0C0);
|
|
427
|
+
static const Color textInverse = white;
|
|
428
|
+
|
|
429
|
+
static const greyF3 = Color(0xFFF3F3F3);
|
|
430
|
+
static const color2D7DD2 = Color(0xFF2D7DD2);
|
|
431
|
+
static const color1D2410 = Color(0xFF1D2410);
|
|
432
|
+
static const color484848 = Color(0xFF484848);
|
|
433
|
+
static const color1C274C = Color(0xFF1C274C);
|
|
434
|
+
static const colorFFF4F2 = Color(0xFFFFF4F2);
|
|
435
|
+
static const colorF5F7FA = Color(0xFFF5F7FA);
|
|
436
|
+
static const colorE6F7ED = Color(0xFFE6F7ED);
|
|
437
|
+
static const color667394 = Color(0xFF667394);
|
|
438
|
+
static const colorFF9800 = Color(0xFFFF9800);
|
|
439
|
+
static const colorB8BCC6 = Color(0xFFB8BCC6);
|
|
440
|
+
static const colorF2F4F7 = Color(0xFFF2F4F7);
|
|
441
|
+
static const colorF9FAFB = Color(0xFFF9FAFB);
|
|
442
|
+
static const colorE1E1E1 = Color(0xFFE1E1E1);
|
|
443
|
+
static const colorE3F2D9 = Color(0xFFE3F2D9);
|
|
444
|
+
static const colorEEEDE9 = Color(0xFFEEEDE9);
|
|
445
|
+
static const color333333 = Color(0xFF333333);
|
|
446
|
+
static const colorEFF8DD = Color(0xFFEFF8DD);
|
|
447
|
+
static const color475467 = Color(0xFF475467);
|
|
448
|
+
static const colorE8EDF5 = Color(0xFFE8EDF5);
|
|
449
|
+
static const colorF4F4F4 = Color(0xFFF4F4F4);
|
|
450
|
+
static const color131A29 = Color(0xFF131A29);
|
|
451
|
+
static const colorD1E8BE = Color(0xFFD1E8BE);
|
|
452
|
+
static const colorE6FAD2 = Color(0xFFE6FAD2);
|
|
453
|
+
static const colorDAFFE0 = Color(0xFFDAFFE0);
|
|
454
|
+
static const color0F000000 = Color(0x0F000000);
|
|
455
|
+
static const colorFAFAFA = Color(0xFFFAFAFA);
|
|
456
|
+
static const colorF8F1DD = Color(0xFFF8F1DD);
|
|
457
|
+
static const colorB7B7B7 = Color(0xFFB7B7B7);
|
|
458
|
+
static const colorFF8C42 = Color(0xFFFF8C42);
|
|
459
|
+
static const color1AFF8C42 = Color(0x1AFF8C42);
|
|
460
|
+
static const colorF1D2BC = Color(0xFFF1D2BC);
|
|
461
|
+
static const colorDFE4F5 = Color(0xFFDFE4F5);
|
|
462
|
+
static const colorF39702 = Color(0xFFF39702);
|
|
463
|
+
static const colorFB1B8D1 = Color(0xFFB1B8D1);
|
|
464
|
+
static const colorF64748B = Color(0xFF64748B);
|
|
465
|
+
static const colorFEF4056 = Color(0xFFEF4056);
|
|
466
|
+
static const colorF586AA6 = Color(0xFF586AA6);
|
|
467
|
+
static const colorFDEF1BC = Color(0xFFDEF1BC);
|
|
468
|
+
static const color101828 = Color(0xFF101828);
|
|
469
|
+
static const colorFFE53E = Color(0xFFFFE53E);
|
|
470
|
+
static const colorEEEAE8 = Color(0xFFEEEAE8);
|
|
471
|
+
static const colorEF4056 = Color(0xFFEF4056);
|
|
472
|
+
static const color1AEF4056 = Color(0x1AEF4056);
|
|
473
|
+
static const colorFF5B42 = Color(0xFFFF5B42);
|
|
474
|
+
static const color33FF5B42 = Color(0x33FF5B42);
|
|
475
|
+
static const color0095FF = Color(0xFF0095FF);
|
|
476
|
+
static const color1A0095FF = Color(0x1A0095FF);
|
|
477
|
+
static const color88CF66 = Color(0xFF88CF66);
|
|
478
|
+
static const color1A88CF66 = Color(0x1A88CF66);
|
|
479
|
+
static const color1A2D7DD2 = Color(0x1A2D7DD2);
|
|
480
|
+
static const colorFEFEFE = Color(0xFFFEFEFE);
|
|
481
|
+
static const colorDCDFEB = Color(0xFFDCDFEB);
|
|
482
|
+
static const color80586AA6 = Color(0x80586AA6);
|
|
483
|
+
static const colorF59AEF9 = Color(0xFF59AEF9);
|
|
484
|
+
static const colorFE4F3FF = Color(0xFFE4F3FF);
|
|
485
|
+
static const colorF6B7280 = Color(0xFF6B7280);
|
|
486
|
+
static const colorFE6F4EC = Color(0xFFE6F4EC);
|
|
487
|
+
static const colorFBFC9DE = Color(0xFFBFC9DE);
|
|
488
|
+
static const colorFE7EDF3 = Color(0xFFE7EDF3);
|
|
489
|
+
static const colorFDCDFEB = Color(0xFFDCDFEB);
|
|
490
|
+
static const colorF101828 = Color(0xFF101828);
|
|
491
|
+
static const colorF646C72 = Color(0xFF646C72);
|
|
492
|
+
static const colorF3F7FC9 = Color(0xFF3F7FC9);
|
|
493
|
+
static const colorFA1AEBE = Color(0xFFA1AEBE);
|
|
494
|
+
static const colorEAF9E6 = Color(0xFFEAF9E6);
|
|
495
|
+
static const colorC8E6C9 = Color(0xFFC8E6C9);
|
|
496
|
+
static const colorE3F2FD = Color(0xFFE3F2FD);
|
|
497
|
+
static const colorFFF3E0 = Color(0xFFFFF3E0);
|
|
498
|
+
static const colorF3E5F5 = Color(0xFFF3E5F5);
|
|
499
|
+
static const color9C27B0 = Color(0xFF9C27B0);
|
|
500
|
+
static const colorFAF9F8 = Color(0xFFFAF9F8);
|
|
501
|
+
static const colorCDCDCD = Color(0xFFCDCDCD);
|
|
502
|
+
static const colorD9DEED = Color(0xFFD9DEED);
|
|
503
|
+
static const colorFDFFFD = Color(0xFFFDFFFD);
|
|
504
|
+
static const colorEBEDF0 = Color(0xFFEBEDF0);
|
|
505
|
+
static const colorF8FAFB = Color(0xFFF8FAFB);
|
|
506
|
+
static const colorFFEAEA = Color(0xFFFFEAEA);
|
|
507
|
+
static const colorEAECF0 = Color(0xFFEAECF0);
|
|
508
|
+
static const colorFFE2D0 = Color(0xFFFFE2D0);
|
|
509
|
+
|
|
510
|
+
// ===========================================================================
|
|
511
|
+
// BACKGROUND
|
|
512
|
+
// ===========================================================================
|
|
513
|
+
static const Color background = white;
|
|
514
|
+
static const Color backgroundSecondary = Color(0xFFF5F5F5);
|
|
515
|
+
static const Color backgroundDisabled = Color(0xFFE5E5E5);
|
|
516
|
+
static const Color backgroundOverlay = Color(0x80000000);
|
|
517
|
+
|
|
518
|
+
// ===========================================================================
|
|
519
|
+
// BORDER
|
|
520
|
+
// ===========================================================================
|
|
521
|
+
static const Color border = Color(0xFFE0E0E0);
|
|
522
|
+
static const Color borderLight = Color(0xFFEEEEEE);
|
|
523
|
+
static const Color borderDark = Color(0xFFBDBDBD);
|
|
524
|
+
|
|
525
|
+
// ===========================================================================
|
|
526
|
+
// GRADIENTS
|
|
527
|
+
// ===========================================================================
|
|
528
|
+
static LinearGradient primaryGradient() => const LinearGradient(
|
|
529
|
+
begin: Alignment.topLeft,
|
|
530
|
+
end: Alignment.bottomRight,
|
|
531
|
+
colors: [primary, primaryLight],
|
|
532
|
+
);
|
|
533
|
+
|
|
534
|
+
static LinearGradient secondaryGradient() => const LinearGradient(
|
|
535
|
+
begin: Alignment.topLeft,
|
|
536
|
+
end: Alignment.bottomRight,
|
|
537
|
+
colors: [primary, secondary1],
|
|
538
|
+
);
|
|
539
|
+
|
|
540
|
+
static LinearGradient primaryTextGradient() =>
|
|
541
|
+
const LinearGradient(colors: [primary, primaryLight]);
|
|
542
|
+
|
|
543
|
+
static LinearGradient fadeGradient() => LinearGradient(
|
|
544
|
+
begin: Alignment.topCenter,
|
|
545
|
+
end: Alignment.bottomCenter,
|
|
546
|
+
colors: [black.withOpacityX(0.3), black],
|
|
547
|
+
);
|
|
548
|
+
|
|
549
|
+
static LinearGradient disabledGradient() =>
|
|
550
|
+
const LinearGradient(colors: [border, borderDark]);
|
|
551
|
+
|
|
552
|
+
static LinearGradient primaryBackgroundGradient() => const LinearGradient(
|
|
553
|
+
begin: Alignment.topCenter,
|
|
554
|
+
end: Alignment.bottomCenter,
|
|
555
|
+
colors: [Color(0xFFF7F7FA), Color(0xFFF2F1EC)],
|
|
556
|
+
);
|
|
557
|
+
|
|
558
|
+
// ===========================================================================
|
|
559
|
+
// UTIL
|
|
560
|
+
// ===========================================================================
|
|
561
|
+
static Color fromHex(String hex) {
|
|
562
|
+
final buffer = StringBuffer();
|
|
563
|
+
if (hex.length == 6 || hex.length == 7) buffer.write('ff');
|
|
564
|
+
buffer.write(hex.replaceFirst('#', ''));
|
|
565
|
+
return Color(int.parse(buffer.toString(), radix: 16));
|
|
566
|
+
}
|
|
386
567
|
}
|
|
387
568
|
EOF
|
|
388
569
|
|
|
@@ -392,13 +573,131 @@ import 'package:flutter/material.dart';
|
|
|
392
573
|
import 'app_colors.dart';
|
|
393
574
|
|
|
394
575
|
class AppStyles {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
static const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
576
|
+
// Font Families
|
|
577
|
+
static const String fontFamily = 'ZenMaruGothic';
|
|
578
|
+
static const String fontHiraginoKakuProW6 = 'ZenMaruGothic';
|
|
579
|
+
static const String fontHiraginoKakuStd = 'ZenMaruGothic';
|
|
580
|
+
|
|
581
|
+
static TextStyle h40({
|
|
582
|
+
String fontFamily = fontFamily,
|
|
583
|
+
Color color = AppColors.black,
|
|
584
|
+
FontWeight fontWeight = FontWeight.w700,
|
|
585
|
+
double? height,
|
|
586
|
+
}) => _textStyle(45.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
587
|
+
|
|
588
|
+
// Text Styles
|
|
589
|
+
static TextStyle h1({
|
|
590
|
+
String fontFamily = fontFamily,
|
|
591
|
+
Color color = AppColors.black,
|
|
592
|
+
FontWeight fontWeight = FontWeight.w700,
|
|
593
|
+
double? height,
|
|
594
|
+
}) => _textStyle(32.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
595
|
+
|
|
596
|
+
static TextStyle h2({
|
|
597
|
+
String fontFamily = fontFamily,
|
|
598
|
+
Color color = AppColors.black,
|
|
599
|
+
FontWeight fontWeight = FontWeight.w600,
|
|
600
|
+
double? height,
|
|
601
|
+
}) => _textStyle(28.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
602
|
+
|
|
603
|
+
static TextStyle headlineLarge({
|
|
604
|
+
String fontFamily = fontFamily,
|
|
605
|
+
Color color = AppColors.black,
|
|
606
|
+
FontWeight fontWeight = FontWeight.w700,
|
|
607
|
+
double? height,
|
|
608
|
+
}) => _textStyle(36.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
609
|
+
|
|
610
|
+
static TextStyle titleLarge({
|
|
611
|
+
String fontFamily = fontFamily,
|
|
612
|
+
Color color = AppColors.black,
|
|
613
|
+
FontWeight fontWeight = FontWeight.w700,
|
|
614
|
+
double? height,
|
|
615
|
+
}) => _textStyle(26.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
616
|
+
|
|
617
|
+
static TextStyle h3({
|
|
618
|
+
String fontFamily = fontFamily,
|
|
619
|
+
Color color = AppColors.black,
|
|
620
|
+
FontWeight fontWeight = FontWeight.w600,
|
|
621
|
+
double? height,
|
|
622
|
+
}) => _textStyle(24.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
623
|
+
|
|
624
|
+
static TextStyle h4({
|
|
625
|
+
String fontFamily = fontFamily,
|
|
626
|
+
Color color = AppColors.black,
|
|
627
|
+
FontWeight fontWeight = FontWeight.w500,
|
|
628
|
+
double? height,
|
|
629
|
+
}) => _textStyle(20.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
630
|
+
|
|
631
|
+
static TextStyle h5({
|
|
632
|
+
String fontFamily = fontFamily,
|
|
633
|
+
Color color = AppColors.black,
|
|
634
|
+
FontWeight fontWeight = FontWeight.w500,
|
|
635
|
+
double? height,
|
|
636
|
+
}) => _textStyle(18.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
637
|
+
|
|
638
|
+
static TextStyle bodyLarge({
|
|
639
|
+
String fontFamily = fontFamily,
|
|
640
|
+
Color color = AppColors.black,
|
|
641
|
+
FontWeight fontWeight = FontWeight.w400,
|
|
642
|
+
double? height,
|
|
643
|
+
}) => _textStyle(16.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
644
|
+
|
|
645
|
+
static TextStyle bodyMedium({
|
|
646
|
+
String fontFamily = fontFamily,
|
|
647
|
+
Color color = AppColors.black,
|
|
648
|
+
FontWeight fontWeight = FontWeight.w400,
|
|
649
|
+
double? height,
|
|
650
|
+
}) => _textStyle(14.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
651
|
+
|
|
652
|
+
static TextStyle bodySmall({
|
|
653
|
+
String fontFamily = fontFamily,
|
|
654
|
+
Color color = AppColors.black,
|
|
655
|
+
FontWeight fontWeight = FontWeight.w400,
|
|
656
|
+
double? height,
|
|
657
|
+
}) => _textStyle(12.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
658
|
+
|
|
659
|
+
static TextStyle caption({
|
|
660
|
+
String fontFamily = fontFamily,
|
|
661
|
+
Color color = AppColors.black,
|
|
662
|
+
FontWeight fontWeight = FontWeight.w400,
|
|
663
|
+
double? height,
|
|
664
|
+
}) => _textStyle(10.0, color, fontWeight, height, fontFamily: fontFamily);
|
|
665
|
+
|
|
666
|
+
// Button Styles
|
|
667
|
+
static TextStyle buttonLarge({
|
|
668
|
+
String fontFamily = fontFamily,
|
|
669
|
+
Color color = AppColors.white,
|
|
670
|
+
FontWeight fontWeight = FontWeight.w600,
|
|
671
|
+
}) => _textStyle(16.0, color, fontWeight, 1.5, fontFamily: fontFamily);
|
|
672
|
+
|
|
673
|
+
static TextStyle buttonMedium({
|
|
674
|
+
String fontFamily = fontFamily,
|
|
675
|
+
Color color = AppColors.white,
|
|
676
|
+
FontWeight fontWeight = FontWeight.w500,
|
|
677
|
+
}) => _textStyle(14.0, color, fontWeight, 1.4, fontFamily: fontFamily);
|
|
678
|
+
|
|
679
|
+
static TextStyle buttonSmall({
|
|
680
|
+
String fontFamily = fontFamily,
|
|
681
|
+
Color color = AppColors.white,
|
|
682
|
+
FontWeight fontWeight = FontWeight.w500,
|
|
683
|
+
}) => _textStyle(12.0, color, fontWeight, 1.3, fontFamily: fontFamily);
|
|
684
|
+
|
|
685
|
+
// Helper method for text styles
|
|
686
|
+
static TextStyle _textStyle(
|
|
687
|
+
double fontSize,
|
|
688
|
+
Color color,
|
|
689
|
+
FontWeight fontWeight,
|
|
690
|
+
double? height, {
|
|
691
|
+
required String fontFamily,
|
|
692
|
+
}) {
|
|
693
|
+
return TextStyle(
|
|
694
|
+
fontFamily: fontFamily,
|
|
695
|
+
fontSize: fontSize,
|
|
696
|
+
color: color,
|
|
697
|
+
fontWeight: fontWeight,
|
|
698
|
+
height: height,
|
|
699
|
+
);
|
|
700
|
+
}
|
|
402
701
|
}
|
|
403
702
|
EOF
|
|
404
703
|
|
|
@@ -406,7 +705,146 @@ cat >lib/src/utils/app_assets.dart <<'EOF'
|
|
|
406
705
|
class AppAssets {
|
|
407
706
|
AppAssets._();
|
|
408
707
|
|
|
409
|
-
|
|
708
|
+
static const String iconsInputRequiredSvg =
|
|
709
|
+
'assets/images/icons/input_required.svg';
|
|
710
|
+
static const String iconsChevronDownSvg =
|
|
711
|
+
'assets/images/icons/chevron down.svg';
|
|
712
|
+
static const String iconsRadioCheckSvg =
|
|
713
|
+
'assets/images/icons/radio_check.svg';
|
|
714
|
+
static const String iconsRadioUncheckSvg =
|
|
715
|
+
'assets/images/icons/radio_uncheck.svg';
|
|
716
|
+
}
|
|
717
|
+
EOF
|
|
718
|
+
|
|
719
|
+
cat >lib/src/utils/app_dimensions.dart <<'EOF'
|
|
720
|
+
import 'package:flutter/material.dart';
|
|
721
|
+
import 'package:get/get.dart';
|
|
722
|
+
|
|
723
|
+
class AppDimensions {
|
|
724
|
+
/// Use for padding
|
|
725
|
+
static const double top = 14;
|
|
726
|
+
static const double marginLeft = 14;
|
|
727
|
+
static const double marginRight = 14;
|
|
728
|
+
static const EdgeInsets sideMargins = EdgeInsets.symmetric(horizontal: 14);
|
|
729
|
+
static const EdgeInsets allMargins = EdgeInsets.all(14);
|
|
730
|
+
|
|
731
|
+
static const EdgeInsetsGeometry paddingTop = EdgeInsets.only(top: 280);
|
|
732
|
+
|
|
733
|
+
static const BorderRadius borderRadius = BorderRadius.all(
|
|
734
|
+
Radius.circular(12),
|
|
735
|
+
);
|
|
736
|
+
|
|
737
|
+
static double bottomBarHeight = 80 + Get.mediaQuery.padding.bottom;
|
|
738
|
+
static double iconPlusBottomBarHeight = 40;
|
|
739
|
+
static double totalBottomBarHeight =
|
|
740
|
+
bottomBarHeight + iconPlusBottomBarHeight;
|
|
741
|
+
}
|
|
742
|
+
EOF
|
|
743
|
+
|
|
744
|
+
cat >lib/src/extensions/color_extension.dart <<'EOF'
|
|
745
|
+
import 'dart:ui';
|
|
746
|
+
|
|
747
|
+
extension ColorOpacity on Color {
|
|
748
|
+
Color withOpacityX(double value) => withAlpha((value * 255).toInt());
|
|
749
|
+
}
|
|
750
|
+
EOF
|
|
751
|
+
|
|
752
|
+
cat >lib/src/extensions/int_extensions.dart <<'EOF'
|
|
753
|
+
import 'package:flutter/material.dart';
|
|
754
|
+
|
|
755
|
+
/// Tai cac UI, Widget sau nay chi can go 6.height or 6.width thay vi phai ghi SizedBox(width: 6), SizedBox(height: 6)
|
|
756
|
+
extension IntExtensions on int? {
|
|
757
|
+
/// Leaves given height of space
|
|
758
|
+
Widget get height => SizedBox(height: this?.toDouble());
|
|
759
|
+
|
|
760
|
+
/// Leaves given width of space
|
|
761
|
+
Widget get width => SizedBox(width: this?.toDouble());
|
|
762
|
+
|
|
763
|
+
/// Radius
|
|
764
|
+
Radius get radius => Radius.circular(this?.toDouble() ?? 0);
|
|
765
|
+
|
|
766
|
+
/// BorderRadius All
|
|
767
|
+
BorderRadius get borderRadiusAll =>
|
|
768
|
+
BorderRadius.circular(this?.toDouble() ?? 0);
|
|
769
|
+
|
|
770
|
+
/// BorderRadius Top
|
|
771
|
+
BorderRadius get borderRadiusTop =>
|
|
772
|
+
BorderRadius.vertical(top: (this ?? 0).radius);
|
|
773
|
+
|
|
774
|
+
/// BorderRadius Bottom
|
|
775
|
+
BorderRadius get borderRadiusBottom =>
|
|
776
|
+
BorderRadius.vertical(bottom: (this ?? 0).radius);
|
|
777
|
+
|
|
778
|
+
/// BorderRadius Left
|
|
779
|
+
BorderRadius get borderRadiusLeft =>
|
|
780
|
+
BorderRadius.horizontal(left: (this ?? 0).radius);
|
|
781
|
+
|
|
782
|
+
/// BorderRadius Right
|
|
783
|
+
BorderRadius get borderRadiusRight =>
|
|
784
|
+
BorderRadius.horizontal(right: (this ?? 0).radius);
|
|
785
|
+
|
|
786
|
+
/// Padding all
|
|
787
|
+
EdgeInsets get paddingAll => EdgeInsets.all((this ?? 0).toDouble());
|
|
788
|
+
|
|
789
|
+
/// Padding horizontal
|
|
790
|
+
EdgeInsets get paddingHorizontal =>
|
|
791
|
+
EdgeInsets.symmetric(horizontal: (this ?? 0).toDouble());
|
|
792
|
+
|
|
793
|
+
/// Padding vertical
|
|
794
|
+
EdgeInsets get paddingVertical =>
|
|
795
|
+
EdgeInsets.symmetric(vertical: (this ?? 0).toDouble());
|
|
796
|
+
|
|
797
|
+
EdgeInsets get paddingLeft => EdgeInsets.only(left: (this ?? 0).toDouble());
|
|
798
|
+
|
|
799
|
+
EdgeInsets get paddingRight => EdgeInsets.only(right: (this ?? 0).toDouble());
|
|
800
|
+
|
|
801
|
+
EdgeInsets get paddingTop => EdgeInsets.only(top: (this ?? 0).toDouble());
|
|
802
|
+
|
|
803
|
+
EdgeInsets get paddingBottom =>
|
|
804
|
+
EdgeInsets.only(bottom: (this ?? 0).toDouble());
|
|
805
|
+
}
|
|
806
|
+
EOF
|
|
807
|
+
|
|
808
|
+
cat >lib/src/extensions/string_extensions.dart <<'EOF'
|
|
809
|
+
import 'dart:io';
|
|
810
|
+
|
|
811
|
+
extension NullableStringExtensions on String? {
|
|
812
|
+
/// Returns [true] if this nullable string is either null or empty.
|
|
813
|
+
bool isNullOrEmpty() {
|
|
814
|
+
return this?.trim().isEmpty ?? true;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
extension StringExtensions on String {
|
|
819
|
+
bool get isNetworkUri => startsWith('http');
|
|
820
|
+
|
|
821
|
+
bool get isSvg => endsWith('.svg');
|
|
822
|
+
|
|
823
|
+
bool get isLocalPath => File(this).existsSync();
|
|
824
|
+
|
|
825
|
+
/// Capitalize first letter of the word
|
|
826
|
+
String get inFirstLetterCaps =>
|
|
827
|
+
length > 0 ? '${this[0].toUpperCase()}${substring(1)}' : '';
|
|
828
|
+
|
|
829
|
+
/// Capitalize first letter of each word
|
|
830
|
+
String get capitalizeFirstOfEach => replaceAll(
|
|
831
|
+
RegExp(' +'),
|
|
832
|
+
' ',
|
|
833
|
+
).split(' ').map((str) => str.inFirstLetterCaps).join(' ');
|
|
834
|
+
|
|
835
|
+
/// Format thousands number to convert to double.
|
|
836
|
+
String get formatThousands => replaceAll(',', '');
|
|
837
|
+
}
|
|
838
|
+
EOF
|
|
839
|
+
|
|
840
|
+
cat >lib/src/extensions/double_extensions.dart <<'EOF'
|
|
841
|
+
extension DoubleNullExtension on double? {
|
|
842
|
+
bool get isNotNull => this != null;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
extension DouleWithoutDecimal on double? {
|
|
846
|
+
String get withoutDecimal =>
|
|
847
|
+
this != null ? (this! % 1 == 0 ? '${this!.toInt()}' : '$this') : '0';
|
|
410
848
|
}
|
|
411
849
|
EOF
|
|
412
850
|
|
|
@@ -443,6 +881,8 @@ class LocaleKey {
|
|
|
443
881
|
LocaleKey._();
|
|
444
882
|
|
|
445
883
|
static const String homeTitle = 'home_title';
|
|
884
|
+
static const String widgetCancel = 'widgetCancel';
|
|
885
|
+
static const String widgetConfirm = 'widgetConfirm';
|
|
446
886
|
}
|
|
447
887
|
EOF
|
|
448
888
|
|
|
@@ -451,6 +891,8 @@ import 'locale_key.dart';
|
|
|
451
891
|
|
|
452
892
|
final Map<String, String> enUs = <String, String>{
|
|
453
893
|
LocaleKey.homeTitle: 'Home',
|
|
894
|
+
LocaleKey.widgetCancel: 'Cancel',
|
|
895
|
+
LocaleKey.widgetConfirm: 'Confirm',
|
|
454
896
|
};
|
|
455
897
|
EOF
|
|
456
898
|
|
|
@@ -459,6 +901,8 @@ import 'locale_key.dart';
|
|
|
459
901
|
|
|
460
902
|
final Map<String, String> jaJp = <String, String>{
|
|
461
903
|
LocaleKey.homeTitle: 'ホーム',
|
|
904
|
+
LocaleKey.widgetCancel: 'キャンセル',
|
|
905
|
+
LocaleKey.widgetConfirm: '決定する',
|
|
462
906
|
};
|
|
463
907
|
EOF
|
|
464
908
|
|