Showing
1 changed file
with
27 additions
and
18 deletions
| @@ -634,7 +634,8 @@ List get list => _list.value; | @@ -634,7 +634,8 @@ List get list => _list.value; | ||
| 634 | ``` | 634 | ``` |
| 635 | ```dart | 635 | ```dart |
| 636 | ListView.builder ( | 636 | ListView.builder ( |
| 637 | -itemCount: list.lenght | 637 | + itemCount: list.lenght |
| 638 | +) | ||
| 638 | ``` | 639 | ``` |
| 639 | You could add an existing list of another type to the observable list using a list.assign (oldList); or the assignAll method, which differs from add, and addAll, which must be of the same type. All existing methods in a list are also available on GetX. | 640 | You could add an existing list of another type to the observable list using a list.assign (oldList); or the assignAll method, which differs from add, and addAll, which must be of the same type. All existing methods in a list are also available on GetX. |
| 640 | 641 | ||
| @@ -700,14 +701,16 @@ To define routes, use GetMaterialApp: | @@ -700,14 +701,16 @@ To define routes, use GetMaterialApp: | ||
| 700 | 701 | ||
| 701 | ```dart | 702 | ```dart |
| 702 | void main() { | 703 | void main() { |
| 703 | - runApp(GetMaterialApp( | 704 | + runApp( |
| 705 | + GetMaterialApp( | ||
| 704 | initialRoute: '/', | 706 | initialRoute: '/', |
| 705 | namedRoutes: { | 707 | namedRoutes: { |
| 706 | '/': GetRoute(page: MyHomePage()), | 708 | '/': GetRoute(page: MyHomePage()), |
| 707 | '/second': GetRoute(page: Second()), | 709 | '/second': GetRoute(page: Second()), |
| 708 | '/third': GetRoute(page: Third(),transition: Transition.cupertino); | 710 | '/third': GetRoute(page: Third(),transition: Transition.cupertino); |
| 709 | }, | 711 | }, |
| 710 | - )); | 712 | + ) |
| 713 | + ); | ||
| 711 | } | 714 | } |
| 712 | ``` | 715 | ``` |
| 713 | 716 | ||
| @@ -743,7 +746,8 @@ You can also receive NamedParameters with Get easily: | @@ -743,7 +746,8 @@ You can also receive NamedParameters with Get easily: | ||
| 743 | 746 | ||
| 744 | ```dart | 747 | ```dart |
| 745 | void main() { | 748 | void main() { |
| 746 | - runApp(GetMaterialApp( | 749 | + runApp( |
| 750 | + GetMaterialApp( | ||
| 747 | initialRoute: '/', | 751 | initialRoute: '/', |
| 748 | namedRoutes: { | 752 | namedRoutes: { |
| 749 | '/': GetRoute(page: MyHomePage()), | 753 | '/': GetRoute(page: MyHomePage()), |
| @@ -754,7 +758,8 @@ void main() { | @@ -754,7 +758,8 @@ void main() { | ||
| 754 | '/second/:user': GetRoute(page: Second()), // receive ID | 758 | '/second/:user': GetRoute(page: Second()), // receive ID |
| 755 | '/third': GetRoute(page: Third(),transition: Transition.cupertino); | 759 | '/third': GetRoute(page: Third(),transition: Transition.cupertino); |
| 756 | }, | 760 | }, |
| 757 | - )); | 761 | + ) |
| 762 | + ); | ||
| 758 | } | 763 | } |
| 759 | ``` | 764 | ``` |
| 760 | Send data on route name | 765 | Send data on route name |
| @@ -776,25 +781,27 @@ And now, all you need to do is use Get.toNamed() to navigate your named routes, | @@ -776,25 +781,27 @@ And now, all you need to do is use Get.toNamed() to navigate your named routes, | ||
| 776 | If you want listen Get events to trigger actions, you can to use routingCallback to it | 781 | If you want listen Get events to trigger actions, you can to use routingCallback to it |
| 777 | ```dart | 782 | ```dart |
| 778 | GetMaterialApp( | 783 | GetMaterialApp( |
| 779 | - routingCallback: (route){ | 784 | + routingCallback: (route) { |
| 780 | if(routing.current == '/second'){ | 785 | if(routing.current == '/second'){ |
| 781 | openAds(); | 786 | openAds(); |
| 782 | } | 787 | } |
| 783 | } | 788 | } |
| 784 | - ``` | 789 | +) |
| 790 | +``` | ||
| 785 | If you are not using GetMaterialApp, you can use the manual API to attach Middleware observer. | 791 | If you are not using GetMaterialApp, you can use the manual API to attach Middleware observer. |
| 786 | 792 | ||
| 787 | - | ||
| 788 | ```dart | 793 | ```dart |
| 789 | void main() { | 794 | void main() { |
| 790 | - runApp(MaterialApp( | 795 | + runApp( |
| 796 | + MaterialApp( | ||
| 791 | onGenerateRoute: Router.generateRoute, | 797 | onGenerateRoute: Router.generateRoute, |
| 792 | initialRoute: "/", | 798 | initialRoute: "/", |
| 793 | navigatorKey: Get.key, | 799 | navigatorKey: Get.key, |
| 794 | navigatorObservers: [ | 800 | navigatorObservers: [ |
| 795 | GetObserver(MiddleWare.observer), // HERE !!! | 801 | GetObserver(MiddleWare.observer), // HERE !!! |
| 796 | ], | 802 | ], |
| 797 | - )); | 803 | + ), |
| 804 | + ); | ||
| 798 | } | 805 | } |
| 799 | ``` | 806 | ``` |
| 800 | Create a MiddleWare class | 807 | Create a MiddleWare class |
| @@ -915,7 +922,6 @@ If you want to know in depth how to change the theme, you can follow this tutori | @@ -915,7 +922,6 @@ If you want to know in depth how to change the theme, you can follow this tutori | ||
| 915 | You can create Global settings for Get. Just add Get.config to your code before pushing any route or do it directly in your GetMaterialApp | 922 | You can create Global settings for Get. Just add Get.config to your code before pushing any route or do it directly in your GetMaterialApp |
| 916 | 923 | ||
| 917 | ```dart | 924 | ```dart |
| 918 | - | ||
| 919 | GetMaterialApp( | 925 | GetMaterialApp( |
| 920 | enableLog: true, | 926 | enableLog: true, |
| 921 | defaultTransition: Transition.fade, | 927 | defaultTransition: Transition.fade, |
| @@ -923,12 +929,13 @@ GetMaterialApp( | @@ -923,12 +929,13 @@ GetMaterialApp( | ||
| 923 | popGesture: Get.isPopGestureEnable, | 929 | popGesture: Get.isPopGestureEnable, |
| 924 | transitionDuration: Get.defaultDurationTransition, | 930 | transitionDuration: Get.defaultDurationTransition, |
| 925 | defaultGlobalState: Get.defaultGlobalState, | 931 | defaultGlobalState: Get.defaultGlobalState, |
| 926 | - ); | 932 | +); |
| 927 | 933 | ||
| 928 | Get.config( | 934 | Get.config( |
| 929 | enableLog = true, | 935 | enableLog = true, |
| 930 | defaultPopGesture = true, | 936 | defaultPopGesture = true, |
| 931 | - defaultTransition = Transitions.cupertino} | 937 | + defaultTransition = Transitions.cupertino |
| 938 | +) | ||
| 932 | ``` | 939 | ``` |
| 933 | 940 | ||
| 934 | 941 | ||
| @@ -939,7 +946,7 @@ GetMaterialApp configures everything for you, but if you want to configure Get M | @@ -939,7 +946,7 @@ GetMaterialApp configures everything for you, but if you want to configure Get M | ||
| 939 | MaterialApp( | 946 | MaterialApp( |
| 940 | navigatorKey: Get.key, | 947 | navigatorKey: Get.key, |
| 941 | navigatorObservers: [GetObserver()], | 948 | navigatorObservers: [GetObserver()], |
| 942 | - ); | 949 | +); |
| 943 | ``` | 950 | ``` |
| 944 | 951 | ||
| 945 | You will also be able to use your own Middleware within GetObserver, this will not influence anything. | 952 | You will also be able to use your own Middleware within GetObserver, this will not influence anything. |
| @@ -948,7 +955,7 @@ You will also be able to use your own Middleware within GetObserver, this will n | @@ -948,7 +955,7 @@ You will also be able to use your own Middleware within GetObserver, this will n | ||
| 948 | MaterialApp( | 955 | MaterialApp( |
| 949 | navigatorKey: Get.key, | 956 | navigatorKey: Get.key, |
| 950 | navigatorObservers: [GetObserver(MiddleWare.observer)], // Here | 957 | navigatorObservers: [GetObserver(MiddleWare.observer)], // Here |
| 951 | - ); | 958 | +); |
| 952 | ``` | 959 | ``` |
| 953 | 960 | ||
| 954 | ```dart | 961 | ```dart |
| @@ -995,7 +1002,7 @@ You don't need the context, and you will find your navigation stack by Id. | @@ -995,7 +1002,7 @@ You don't need the context, and you will find your navigation stack by Id. | ||
| 995 | 1002 | ||
| 996 | See how simple it is: | 1003 | See how simple it is: |
| 997 | ```dart | 1004 | ```dart |
| 998 | - Navigator( | 1005 | +Navigator( |
| 999 | key: nestedKey(1), // create a key by index | 1006 | key: nestedKey(1), // create a key by index |
| 1000 | initialRoute: '/', | 1007 | initialRoute: '/', |
| 1001 | onGenerateRoute: (settings) { | 1008 | onGenerateRoute: (settings) { |
| @@ -1011,7 +1018,8 @@ See how simple it is: | @@ -1011,7 +1018,8 @@ See how simple it is: | ||
| 1011 | onPressed: () { | 1018 | onPressed: () { |
| 1012 | Get.toNamed('/second', id:1); // navigate by your nested route by index | 1019 | Get.toNamed('/second', id:1); // navigate by your nested route by index |
| 1013 | }, | 1020 | }, |
| 1014 | - child: Text("Go to second")), | 1021 | + child: Text("Go to second"), |
| 1022 | + ), | ||
| 1015 | ), | 1023 | ), |
| 1016 | ), | 1024 | ), |
| 1017 | ); | 1025 | ); |
| @@ -1029,7 +1037,8 @@ See how simple it is: | @@ -1029,7 +1037,8 @@ See how simple it is: | ||
| 1029 | ), | 1037 | ), |
| 1030 | ); | 1038 | ); |
| 1031 | } | 1039 | } |
| 1032 | - }), | 1040 | + } |
| 1041 | +), | ||
| 1033 | ``` | 1042 | ``` |
| 1034 | 1043 | ||
| 1035 | 1044 |
-
Please register or login to post a comment