Jonny Borges

update buttons to Material spec

... ... @@ -136,7 +136,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))),
// Reemplace el Navigator.push de 8 líneas por un simple Get.to(). No necesitas contexto
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -148,7 +148,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
// Remplacez les 8 lignes Navigator.push par un simple Get.to(). Vous n'avez pas besoin de 'context'
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -148,7 +148,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
// Ganti 8 baris Navigator.push menggunan Get.to() agar lebih sederhana. Anda tidak perlu `context`.
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -145,7 +145,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
// 8줄의 Navigator.push를 간단한 Get.to()로 변경합니다. context는 필요없습니다.
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -149,7 +149,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
// Replace the 8 lines Navigator.push by a simple Get.to(). You don't need context
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -113,7 +113,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))),
// Replace the 8 lines Navigator.push by a simple Get.to(). You don't need context
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -158,7 +158,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Total de cliques: ${c.count}"))),
// Troque o Navigator.push de 8 linhas por um simples Get.to(). Você não precisa do 'context'
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Ir pra Outra tela"), onPressed: () => Get.to(Outra()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -129,7 +129,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Кликов: ${c.count}"))),
// Замените 8 строк Navigator.push простым Get.to(). Вам не нужен context!
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Перейти к Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -137,7 +137,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
// Replace the 8 lines Navigator.push by a simple Get.to(). You don't need context
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -138,7 +138,7 @@ class Home extends StatelessWidget {
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
// 用一个简单的Get.to()即可代替Navigator.push那8行,无需上下文!
body: Center(child: RaisedButton(
body: Center(child: ElevatedButton(
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
... ...
... ... @@ -313,7 +313,7 @@ class First extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -338,7 +338,7 @@ class Second extends StatelessWidget {
title: Text('second Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -357,7 +357,7 @@ class Third extends StatelessWidget {
title: Text("Third Route"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -428,7 +428,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -518,7 +518,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // navigate by your nested route by index
... ...
... ... @@ -312,7 +312,7 @@ class First extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -337,7 +337,7 @@ class Second extends StatelessWidget {
title: Text('second Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -356,7 +356,7 @@ class Third extends StatelessWidget {
title: Text("Third Route"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -427,7 +427,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -519,7 +519,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // navigate by your nested route by index
... ...
... ... @@ -314,7 +314,7 @@ class First extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -339,7 +339,7 @@ class Second extends StatelessWidget {
title: Text('second Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -358,7 +358,7 @@ class Third extends StatelessWidget {
title: Text("Third Route"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -428,7 +428,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -518,7 +518,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // naviguer votre itinéraire imbriqué par index
... ...
... ... @@ -315,7 +315,7 @@ class First extends StatelessWidget {
title: Text('Halaman Pertama'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Pindah halaman'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -340,7 +340,7 @@ class Second extends StatelessWidget {
title: Text('Halaman kedua'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Pindah halaman'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -359,7 +359,7 @@ class Third extends StatelessWidget {
title: Text("Halaman ketiga"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -430,7 +430,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -520,7 +520,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // pindah ke halaman bersarang anda menggunakan index
... ...
... ... @@ -313,7 +313,7 @@ class First extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -338,7 +338,7 @@ class Second extends StatelessWidget {
title: Text('second Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -357,7 +357,7 @@ class Third extends StatelessWidget {
title: Text("Third Route"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -428,7 +428,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -518,7 +518,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // index로 중첩된 경로를 탐색
... ...
... ... @@ -140,7 +140,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -393,7 +393,7 @@ class Primeira extends StatelessWidget {
title: Text('Primeira rota'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Abrir rota'),
onPressed: () {
Get.toNamed("/segunda");
... ... @@ -418,7 +418,7 @@ class Segunda extends StatelessWidget {
title: Text('Segunda rota'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Abrir rota'),
onPressed: () {
Get.toNamed("/terceira");
... ... @@ -437,7 +437,7 @@ class Terceira extends StatelessWidget {
title: Text("Terceira Rota"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -512,7 +512,7 @@ Navigator(
title: Text("Principal"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
child: Text("Ir para a segunda"),
onPressed: () {
... ...
... ... @@ -313,7 +313,7 @@ class First extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -338,7 +338,7 @@ class Second extends StatelessWidget {
title: Text('second Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -357,7 +357,7 @@ class Third extends StatelessWidget {
title: Text("Third Route"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -428,7 +428,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -518,7 +518,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // navigate by your nested route by index
... ...
... ... @@ -308,7 +308,7 @@ class First extends StatelessWidget {
title: Text('First Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/second");
... ... @@ -333,7 +333,7 @@ class Second extends StatelessWidget {
title: Text('second Route'),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open route'),
onPressed: () {
Get.toNamed("/third");
... ... @@ -352,7 +352,7 @@ class Third extends StatelessWidget {
title: Text("Third Route"),
),
body: Center(
child: RaisedButton(
child: ElevatedButton(
onPressed: () {
Get.back();
},
... ... @@ -422,7 +422,7 @@ Get.snackbar(
// Color leftBarIndicatorColor,
// List<BoxShadow> boxShadows,
// Gradient backgroundGradient,
// FlatButton mainButton,
// TextButton mainButton,
// OnTap onTap,
// bool isDismissible,
// bool showProgressIndicator,
... ... @@ -512,7 +512,7 @@ Navigator(
title: Text("Main"),
),
body: Center(
child: FlatButton(
child: TextButton(
color: Colors.blue,
onPressed: () {
Get.toNamed('/second', id:1); // navigate by your nested route by index
... ...
... ... @@ -53,7 +53,7 @@ class Home extends StatelessWidget {
builder: (_) => Text(
'clicks: ${controller.count}',
)),
RaisedButton(
ElevatedButton(
child: Text('Next Route'),
onPressed: () {
Get.to(Second());
... ... @@ -120,7 +120,7 @@ class Home extends StatelessWidget {
builder: (_) => Text(
'clicks: ${controller.count}',
)),
RaisedButton(
ElevatedButton(
child: Text('Next Route'),
onPressed: () {
Get.to(Second());
... ... @@ -161,7 +161,7 @@ class Home extends StatelessWidget {
Obx(() => Text(
'clicks: ${controller.count}',
)),
RaisedButton(
ElevatedButton(
child: Text('Next Route'),
onPressed: () {
Get.to(Second());
... ... @@ -362,13 +362,13 @@ class First extends StatelessWidget {
builder: (_) => Text(
'clicks: ${_.count}',
)),
RaisedButton(
ElevatedButton(
child: Text('Next Route'),
onPressed: () {
Get.toNamed('/second');
},
),
RaisedButton(
ElevatedButton(
child: Text('Change locale to English'),
onPressed: () {
Get.updateLocale(Locale('en', 'UK'));
... ... @@ -421,13 +421,13 @@ class Second extends GetView<ControllerX> {
GetX<ControllerX>(
builder: (_) => Text('Age: ${_.user.value.age}'),
),
RaisedButton(
ElevatedButton(
child: Text("Go to last page"),
onPressed: () {
Get.toNamed('/third', arguments: 'arguments of second');
},
),
RaisedButton(
ElevatedButton(
child: Text("Back page and open snackbar"),
onPressed: () {
Get.back();
... ... @@ -437,25 +437,25 @@ class Second extends GetView<ControllerX> {
);
},
),
RaisedButton(
ElevatedButton(
child: Text("Increment"),
onPressed: () {
Get.find<ControllerX>().increment();
},
),
RaisedButton(
ElevatedButton(
child: Text("Increment"),
onPressed: () {
Get.find<ControllerX>().increment2();
},
),
RaisedButton(
ElevatedButton(
child: Text("Update name"),
onPressed: () {
Get.find<ControllerX>().updateUser();
},
),
RaisedButton(
ElevatedButton(
child: Text("Dispose worker"),
onPressed: () {
Get.find<ControllerX>().disposeWorker();
... ...
... ... @@ -61,18 +61,24 @@ class HomeView extends GetView<HomeController> {
SizedBox(
height: 10,
),
OutlineButton(
borderSide: BorderSide(
OutlinedButton(
style: OutlinedButton.styleFrom(
textStyle: TextStyle(color: Colors.black),
side: BorderSide(
color: Colors.deepPurple,
width: 3,
),
shape: StadiumBorder(),
),
onPressed: () {
Get.toNamed('/home/country');
},
child: Text(
'fetch_country'.tr,
style: TextStyle(fontWeight: FontWeight.bold),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
)
],
... ...
... ... @@ -125,7 +125,7 @@ extension ExtensionSnackbar on GetInterface {
Color leftBarIndicatorColor,
List<BoxShadow> boxShadows,
Gradient backgroundGradient,
FlatButton mainButton,
TextButton mainButton,
OnTap onTap,
bool isDismissible,
bool showProgressIndicator,
... ... @@ -326,23 +326,25 @@ extension ExtensionDialog on GetInterface {
actions.add(cancel);
} else {
if (leanCancel) {
actions.add(FlatButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
actions.add(TextButton(
style: TextButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8),
shape: RoundedRectangleBorder(
side: BorderSide(
color: buttonColor ?? theme.accentColor,
width: 2,
style: BorderStyle.solid),
borderRadius: BorderRadius.circular(100)),
),
onPressed: () {
onCancel?.call();
back();
},
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8),
child: Text(
textCancel ?? "Cancel",
style: TextStyle(color: cancelTextColor ?? theme.accentColor),
),
shape: RoundedRectangleBorder(
side: BorderSide(
color: buttonColor ?? theme.accentColor,
width: 2,
style: BorderStyle.solid),
borderRadius: BorderRadius.circular(100)),
));
}
}
... ... @@ -350,14 +352,18 @@ extension ExtensionDialog on GetInterface {
actions.add(confirm);
} else {
if (leanConfirm) {
actions.add(FlatButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
color: buttonColor ?? theme.accentColor,
actions.add(TextButton(
style: TextButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
//color: buttonColor ?? theme.accentColor,
backgroundColor: buttonColor ?? theme.accentColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100)),
),
child: Text(
textConfirm ?? "Ok",
style: TextStyle(color: confirmTextColor ?? theme.primaryColor),
style:
TextStyle(color: confirmTextColor ?? theme.backgroundColor),
),
onPressed: () {
onConfirm?.call();
... ...
... ... @@ -13,7 +13,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
effective_dart: ^1.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
... ...
... ... @@ -485,7 +485,7 @@ void main() {
await tester.pumpWidget(
GetMaterialApp(
popGesture: true,
home: RaisedButton(
home: ElevatedButton(
child: Text('Open Snackbar'),
onPressed: () {
Get.snackbar('title', "message", duration: Duration(seconds: 1));
... ... @@ -504,7 +504,7 @@ void main() {
testWidgets("Get.rawSnackbar test", (tester) async {
await tester.pumpWidget(
Wrapper(
child: RaisedButton(
child: ElevatedButton(
child: Text('Open Snackbar'),
onPressed: () {
Get.rawSnackbar(
... ...
... ... @@ -32,7 +32,7 @@ void main() {
Text(
'Map: ${controller.map.length}',
),
FlatButton(
TextButton(
child: Text("increment"),
onPressed: () => controller.increment(),
)
... ...
... ... @@ -17,7 +17,7 @@ void main() {
Text('List: ${controller.list.length}'),
Text('Bool: ${controller.boolean.value}'),
Text('Map: ${controller.map.length}'),
FlatButton(
TextButton(
child: Text("increment"),
onPressed: controller.increment,
),
... ...
... ... @@ -30,7 +30,7 @@ void main() {
Text(
'Map: ${controller.map.length}',
),
FlatButton(
TextButton(
child: Text("increment"),
onPressed: () => controller.increment(),
),
... ...
... ... @@ -14,11 +14,11 @@ void main() {
Text(
'${controller.counter}',
),
FlatButton(
TextButton(
child: Text("increment"),
onPressed: () => controller.increment(),
),
FlatButton(
TextButton(
child: Text("incrementWithId"),
onPressed: () => controller.incrementWithId(),
),
... ...