This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
getx.xml
212 lines (205 loc) · 15.9 KB
/
getx.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<templateSet group="getx">
<template name="getcontroller"
description="Generates GetxController"
toReformat="false" toShortenFQNames="true" value="import 'package:get/get.dart'; import 'package:meta/meta.dart'; class $My$Controller extends GetxController { final _$prop$ = $value$.obs; set $prop$(value) => _$prop$.value = value; get $prop$ => _$prop$.value; }">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<variable name="prop" alwaysStopAt="true" defaultValue=""obj"" expression="" />
<variable name="value" alwaysStopAt="true" defaultValue=""''"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getfinal_"
description="Generates accessor for Controller: getter, setter and final private var"
toReformat="false"
toShortenFQNames="true" value=" final _$prop$ = $val$.obs; get $prop$ => _$prop$.value; set $prop$(val) => _$prop$.value = val; ">
<variable name="prop" alwaysStopAt="true" defaultValue=""value"" expression="" />
<variable name="val" alwaysStopAt="true" defaultValue=""''"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getfinal" description="Generates simple final observable."
toReformat="false" toShortenFQNames="true" value="final $prop$ = $value$.obs;">
<variable name="prop" alwaysStopAt="true" defaultValue=""value"" expression="" />
<variable name="value" alwaysStopAt="true" defaultValue=""''"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getcontrollervoid"
description="Generates an empty GetxController"
toReformat="false" toShortenFQNames="true" value="import 'package:get/get.dart'; import 'package:meta/meta.dart'; class $My$Controller extends GetxController { $END$ }">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getget" description="Generates a getter for a public variable."
toReformat="false" toShortenFQNames="true"
value="get $prop$ => $otherProp$.value;$END$">
<variable name="prop" alwaysStopAt="true" defaultValue=""prop"" expression="" />
<variable name="otherProp" alwaysStopAt="true" defaultValue=""otherProp""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getget_" description="Generates a getter for a private variable."
toReformat="false" toShortenFQNames="true"
value="get $prop$ => _$otherProp$.value;$END$">
<variable name="prop" alwaysStopAt="true" defaultValue=""prop"" expression="" />
<variable name="otherProp" alwaysStopAt="true" defaultValue=""otherProp""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getset" description="Generates a setter for a public variable."
toReformat="false" toShortenFQNames="true"
value="set $prop$(val) => $otherProp$.value = val;$END$">
<variable name="prop" alwaysStopAt="true" defaultValue=""prop"" expression="" />
<variable name="otherProp" alwaysStopAt="true" defaultValue=""otherProp""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getset_" description="Generates a setter for a private variable."
toReformat="false" toShortenFQNames="true"
value="set $prop$(val) => _$otherProp$.value = val;$END$">
<variable name="prop" alwaysStopAt="true" defaultValue=""prop"" expression="" />
<variable name="otherProp" alwaysStopAt="true" defaultValue=""otherProp""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getmodel"
description="Generates a base Model for data."
toReformat="false" toShortenFQNames="true" value="class $My$Model { int id; String name; $My$Model({ this.id, this.name }); $My$Model.fromJson(Map<String, dynamic> json){ this.id = json['id']; this.name = json['name']; } Map<String, dynamic> toJson() => {'id':id, 'name':name }; }$END$">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getrxmodel"
description="Generates a sample RxModel."
toReformat="false" toShortenFQNames="true" value="import 'package:get/get.dart'; class Rx$My$Model { final id = 0.obs; final name = 'name'.obs; } class $My$Model { $My$Model({id, name}); final rx = Rx$My$Model(); get name => rx.name.value; set name(value) => rx.name.value = value; get id => rx.id.value; set id(value) => rx.id.value = value; $My$Model.fromJson(Map<String, dynamic> json) { id = json['id']; name = json['name']; } Map<String, dynamic> toJson() => { 'name' : name, 'id':id, }; } $END$">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getprovider"
description="Generates a sample Provider file for APIs."
toReformat="false" toShortenFQNames="true"
value="import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:meta/meta.dart'; const baseUrl = 'http://gerador-nomes.herokuapp.com/nomes/10'; class $My$ApiClient { final http.Client httpClient; $My$ApiClient({@required this.httpClient}); final Map<String, String> _defaultHeaders = { 'Content-Type': 'application/json' }; Future<List<$Model$>> getAll() async { try { final response = await httpClient.get(baseUrl); if (response.statusCode == 200) { Map<String, dynamic> jsonResponse = jsonDecode(response.body); return jsonResponse['data'] .map((json) => $Model$.fromJson(json)) .toList(); } else { print('Error -getAll'); } } catch (_) {} return null; } Future getId(id) async { try { final response = await httpClient.get(baseUrl); if (response.statusCode == 200) { Map<String, dynamic> jsonResponse = jsonDecode(response.body); // TODO: implement methods! } else{ print('Error -getId'); } } catch (_) {} return null; } Future add(obj) async { try { final response = await httpClient.post(baseUrl, headers: _defaultHeaders, body: jsonEncode(obj)); if (response.statusCode == 200) { // TODO: implement methods! } else { print('Error -add'); } } catch (_) {} return null; } Future edit(obj) async { try { final response = await httpClient.put(baseUrl, headers: _defaultHeaders, body: jsonEncode(obj)); if (response.statusCode == 200) { // TODO: implement methods! } else { print('Error -edit'); } } catch (_) {} return null; } Future delete(obj) async { try { final response = await httpClient.delete(baseUrl); if (response.statusCode == 200) { // TODO: implement methods! } else { print('Error -delete'); } } catch (_) {} return null; } }$END$">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<variable name="Model" alwaysStopAt="true" defaultValue=""MyModel""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getproviderdio"
description="Generates a simple sample Provider file with Dio for API."
toReformat="false" toShortenFQNames="true"
value="import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:meta/meta.dart'; const baseUrl = 'http://gerador-nomes.herokuapp.com/nomes/10'; class $My$ApiClient { final Dio httpClient; $My$ApiClient({@required this.httpClient}); Future<List<$Model$>>getAll() async { try { var response = await httpClient.get(baseUrl); if (response.statusCode == 200) { Map<String, dynamic> jsonResponse = json.decode(response.data); return jsonResponse['data'].map((obj) => $Model$.fromJson(obj)).toList(); } else { print('Error -getAll'); } } catch (_) {} return null ; } }$END$">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<variable name="Model" alwaysStopAt="true" defaultValue=""MyModel""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getrepo"
description="Generates a sample Repository file"
toReformat="false" toShortenFQNames="true" value="import 'package:meta/meta.dart'; class $main$Repository { final $api$ApiClient apiClient; $main$Repository({@required this.apiClient}) : assert(apiClient != null); getAll() { return apiClient.getAll(); } getId(id) { return apiClient.getId(id); } delete(id) { return apiClient.delete(id); } edit(obj) { return apiClient.edit(obj); } add(obj) { return apiClient.add(obj); } } $END$ ">
<variable name="main" alwaysStopAt="true" defaultValue=""My"" expression="" />
<variable name="api" alwaysStopAt="true" defaultValue=""My"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getx"
description="GetX widget shortcut."
toReformat="false" toShortenFQNames="true" value="GetX<$main$>( init: $main$(), builder: (_) => Text(_.var), )$END$">
<variable name="main" alwaysStopAt="true" defaultValue=""HomeController""
expression="completeSmart()" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getpagevoid"
description="Generates a void Page class"
toReformat="false" toShortenFQNames="true" value="import 'package:flutter/material.dart'; import 'package:get/get.dart'; class $My$Page extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('$My$ Page')), body: Container( child: Text('$My$ Body$END$'), ), ); } }">
<variable name="My" alwaysStopAt="true" defaultValue=""My"" expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getpage"
description="Generates a Page file with a Controller"
toReformat="false" toShortenFQNames="true"
value="import 'package:flutter/material.dart'; import 'package:get/get.dart'; $httpImport$ class $Name$Page extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('$Name$ Page')), body: $WidgetParent$( child: GetX<$Controller$>( init: $Controller$(), builder: (_) { return $WidgetChild$($END$); }), ), ); } } ">
<variable name="httpImport"
alwaysStopAt="true"
defaultValue="" "" expression="enum("import 'package:http/http.dart' as http;","import 'package:dio/dio.dart';"," ")" />
<variable name="Name" alwaysStopAt="true" defaultValue=""My"" expression="" />
<variable name="WidgetParent" alwaysStopAt="true" defaultValue=""Container""
expression="" />
<variable name="Controller" alwaysStopAt="true" defaultValue=""MyController""
expression="" />
<variable name="WidgetChild" alwaysStopAt="true" defaultValue=""Container""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getobx" description="Generates ObxX function" toReformat="false"
toShortenFQNames="true" value="Obx(() => $END$),">
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getmain" description="Generates a main file with GetMaterialApp" toReformat="false" toShortenFQNames="true"
value="import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() { runApp(GetMaterialApp(
debugShowCheckedModeBanner: false,
initialRoute: '/',
theme: appThemeData,
defaultTransition: Transition.fade,
getPages: MyRoutes.routes,
home: HomePage(),
));
}">
<variable name="Name" alwaysStopAt="true" defaultValue=""My"" expression="" />
<variable name="WidgetParent" alwaysStopAt="true" defaultValue=""Container""
expression="" />
<variable name="Controller" alwaysStopAt="true" defaultValue=""MyController""
expression="" />
<variable name="WidgetChild" alwaysStopAt="true" defaultValue=""Container""
expression="" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getpagesroutes" description="Generate file pages" toReformat="false" toShortenFQNames="true"
value="import 'package:get/get.dart'; part './app_routes.dart'; abstract class AppPages { static final pages = [ GetPage(name: Routes.HOME, page:()=> MyHomePage(),), ]; }
">
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
<template name="getpageroute"
description="Generate route page."
toReformat="false" toShortenFQNames="true" value="GetPage(name: Routes.$main$, page:()=> $page$Page()),">
<variable name="main" alwaysStopAt="true" defaultValue=""CONST_ROUTE"" expression="completeSmart()" />
<variable name="page" alwaysStopAt="true" defaultValue=""My"" expression="completeSmart()" />
<context>
<option name="FLUTTER" value="true" />
</context>
</template>
</templateSet>