Showing
10 changed files
with
142 additions
and
115 deletions
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | # This file should be version controlled. | 4 | # This file should be version controlled. |
5 | 5 | ||
6 | version: | 6 | version: |
7 | - revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 7 | + revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
8 | channel: stable | 8 | channel: stable |
9 | 9 | ||
10 | project_type: app | 10 | project_type: app |
@@ -13,26 +13,26 @@ project_type: app | @@ -13,26 +13,26 @@ project_type: app | ||
13 | migration: | 13 | migration: |
14 | platforms: | 14 | platforms: |
15 | - platform: root | 15 | - platform: root |
16 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
17 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 16 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
17 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
18 | - platform: android | 18 | - platform: android |
19 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
20 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 19 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
20 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
21 | - platform: ios | 21 | - platform: ios |
22 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
23 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 22 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
23 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
24 | - platform: linux | 24 | - platform: linux |
25 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
26 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 25 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
26 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
27 | - platform: macos | 27 | - platform: macos |
28 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
29 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 28 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
29 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
30 | - platform: web | 30 | - platform: web |
31 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
32 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 31 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
32 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
33 | - platform: windows | 33 | - platform: windows |
34 | - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | ||
35 | - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a | 34 | + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b |
35 | + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b | ||
36 | 36 | ||
37 | # User provided section | 37 | # User provided section |
38 | 38 |
@@ -7,7 +7,6 @@ | @@ -7,7 +7,6 @@ | ||
7 | 7 | ||
8 | # The following line activates a set of recommended lints for Flutter apps, | 8 | # The following line activates a set of recommended lints for Flutter apps, |
9 | # packages, and plugins designed to encourage good coding practices. | 9 | # packages, and plugins designed to encourage good coding practices. |
10 | -include: package:flutter_lints/flutter.yaml | ||
11 | 10 | ||
12 | linter: | 11 | linter: |
13 | # The lint rules applied to this project can be customized in the | 12 | # The lint rules applied to this project can be customized in the |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import 'package:get/get.dart'; | 2 | import 'package:get/get.dart'; |
3 | 3 | ||
4 | -import 'en_us.dart'; | ||
5 | -import 'pt_br.dart'; | 4 | +import 'en_US.dart'; |
5 | +import 'pt_BR.dart'; | ||
6 | 6 | ||
7 | class TranslationService extends Translations { | 7 | class TranslationService extends Translations { |
8 | static Locale? get locale => Get.deviceLocale; | 8 | static Locale? get locale => Get.deviceLocale; |
@@ -15,6 +15,7 @@ class MyApp extends StatelessWidget { | @@ -15,6 +15,7 @@ class MyApp extends StatelessWidget { | ||
15 | @override | 15 | @override |
16 | Widget build(BuildContext context) { | 16 | Widget build(BuildContext context) { |
17 | return GetMaterialApp( | 17 | return GetMaterialApp( |
18 | + theme: ThemeData(useMaterial3: true), | ||
18 | debugShowCheckedModeBanner: false, | 19 | debugShowCheckedModeBanner: false, |
19 | enableLog: true, | 20 | enableLog: true, |
20 | logWriterCallback: Logger.write, | 21 | logWriterCallback: Logger.write, |
@@ -25,9 +25,11 @@ class CasesModel { | @@ -25,9 +25,11 @@ class CasesModel { | ||
25 | factory CasesModel.fromJson(Map<String, dynamic> json) => CasesModel( | 25 | factory CasesModel.fromJson(Map<String, dynamic> json) => CasesModel( |
26 | message: json["Message"] as String, | 26 | message: json["Message"] as String, |
27 | global: Global.fromJson(json["Global"] as Map<String, dynamic>), | 27 | global: Global.fromJson(json["Global"] as Map<String, dynamic>), |
28 | - countries: List<Country>.from((json["Countries"] as Iterable).map( | ||
29 | - (x) => Country.fromJson(x as Map<String, dynamic>), | ||
30 | - )), | 28 | + countries: json["Countries"] == null |
29 | + ? [] | ||
30 | + : List<Country>.from((json["Countries"] as Iterable).map( | ||
31 | + (x) => Country.fromJson(x as Map<String, dynamic>), | ||
32 | + )), | ||
31 | date: DateTime.parse(json["Date"] as String), | 33 | date: DateTime.parse(json["Date"] as String), |
32 | ); | 34 | ); |
33 | 35 |
@@ -18,38 +18,36 @@ class CountryView extends GetView<HomeController> { | @@ -18,38 +18,36 @@ class CountryView extends GetView<HomeController> { | ||
18 | "https://images.pexels.com/photos/3902882/pexels-photo-3902882.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"))), | 18 | "https://images.pexels.com/photos/3902882/pexels-photo-3902882.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"))), |
19 | child: BackdropFilter( | 19 | child: BackdropFilter( |
20 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), | 20 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), |
21 | - child: Container( | ||
22 | - child: Scaffold( | 21 | + child: Scaffold( |
22 | + backgroundColor: Colors.transparent, | ||
23 | + appBar: AppBar( | ||
24 | + title: Text('corona_by_country'.tr), | ||
23 | backgroundColor: Colors.transparent, | 25 | backgroundColor: Colors.transparent, |
24 | - appBar: AppBar( | ||
25 | - title: Text('corona_by_country'.tr), | ||
26 | - backgroundColor: Colors.transparent, | ||
27 | - elevation: 0, | ||
28 | - centerTitle: true, | ||
29 | - ), | ||
30 | - body: Center( | ||
31 | - child: ListView.builder( | ||
32 | - itemCount: controller.state.countries.length, | ||
33 | - itemBuilder: (context, index) { | ||
34 | - final country = controller.state.countries[index]; | ||
35 | - return ListTile( | ||
36 | - onTap: () async { | ||
37 | - //Get.rootDelegate.toNamed('/home/country'); | ||
38 | - final data = await Get.toNamed( | ||
39 | - '/home/country/details?id=$index'); | ||
40 | - print(data); | ||
41 | - }, | ||
42 | - trailing: CircleAvatar( | ||
43 | - backgroundImage: NetworkImage( | ||
44 | - "https://flagpedia.net/data/flags/normal/${country.countryCode.toLowerCase()}.png"), | ||
45 | - ), | ||
46 | - title: Text(country.country), | ||
47 | - subtitle: Text( | ||
48 | - // ignore: lines_longer_than_80_chars | ||
49 | - '${'total_infecteds'.tr}${' ${country.totalConfirmed}'}'), | ||
50 | - ); | ||
51 | - }), | ||
52 | - ), | 26 | + elevation: 0, |
27 | + centerTitle: true, | ||
28 | + ), | ||
29 | + body: Center( | ||
30 | + child: ListView.builder( | ||
31 | + itemCount: controller.state.countries.length, | ||
32 | + itemBuilder: (context, index) { | ||
33 | + final country = controller.state.countries[index]; | ||
34 | + return ListTile( | ||
35 | + onTap: () async { | ||
36 | + //Get.rootDelegate.toNamed('/home/country'); | ||
37 | + final data = | ||
38 | + await Get.toNamed('/home/country/details?id=$index'); | ||
39 | + print(data); | ||
40 | + }, | ||
41 | + trailing: CircleAvatar( | ||
42 | + backgroundImage: NetworkImage( | ||
43 | + "https://flagpedia.net/data/flags/normal/${country.countryCode.toLowerCase()}.png"), | ||
44 | + ), | ||
45 | + title: Text(country.country), | ||
46 | + subtitle: Text( | ||
47 | + // ignore: lines_longer_than_80_chars | ||
48 | + '${'total_infecteds'.tr}${' ${country.totalConfirmed}'}'), | ||
49 | + ); | ||
50 | + }), | ||
53 | ), | 51 | ), |
54 | ), | 52 | ), |
55 | ), | 53 | ), |
@@ -22,70 +22,68 @@ class DetailsView extends GetView<HomeController> { | @@ -22,70 +22,68 @@ class DetailsView extends GetView<HomeController> { | ||
22 | ), | 22 | ), |
23 | child: BackdropFilter( | 23 | child: BackdropFilter( |
24 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), | 24 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), |
25 | - child: Container( | ||
26 | - child: Scaffold( | ||
27 | - backgroundColor: Colors.transparent, | ||
28 | - appBar: AppBar( | ||
29 | - title: Text('details'.tr), | ||
30 | - backgroundColor: Colors.black12, | ||
31 | - elevation: 0, | ||
32 | - centerTitle: true, | ||
33 | - ), | ||
34 | - body: Center( | ||
35 | - child: Column( | ||
36 | - mainAxisAlignment: MainAxisAlignment.center, | ||
37 | - children: [ | ||
38 | - Text( | ||
39 | - '${country.country}', | ||
40 | - style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold), | ||
41 | - ), | ||
42 | - SizedBox( | ||
43 | - height: 35, | ||
44 | - ), | ||
45 | - Text( | ||
46 | - 'total_confirmed'.tr, | ||
47 | - style: TextStyle( | ||
48 | - fontSize: 25, | ||
49 | - ), | ||
50 | - ), | ||
51 | - Text( | ||
52 | - '${country.totalConfirmed}', | ||
53 | - style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | ||
54 | - ), | ||
55 | - SizedBox( | ||
56 | - height: 10, | ||
57 | - ), | ||
58 | - Text( | ||
59 | - 'total_deaths'.tr, | ||
60 | - style: TextStyle( | ||
61 | - fontSize: 25, | ||
62 | - ), | ||
63 | - ), | ||
64 | - Text( | ||
65 | - '${country.totalDeaths}', | ||
66 | - style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | ||
67 | - ), | ||
68 | - SizedBox( | ||
69 | - height: 10, | 25 | + child: Scaffold( |
26 | + backgroundColor: Colors.transparent, | ||
27 | + appBar: AppBar( | ||
28 | + title: Text('details'.tr), | ||
29 | + backgroundColor: Colors.black12, | ||
30 | + elevation: 0, | ||
31 | + centerTitle: true, | ||
32 | + ), | ||
33 | + body: Center( | ||
34 | + child: Column( | ||
35 | + mainAxisAlignment: MainAxisAlignment.center, | ||
36 | + children: [ | ||
37 | + Text( | ||
38 | + '${country.country}', | ||
39 | + style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold), | ||
40 | + ), | ||
41 | + SizedBox( | ||
42 | + height: 35, | ||
43 | + ), | ||
44 | + Text( | ||
45 | + 'total_confirmed'.tr, | ||
46 | + style: TextStyle( | ||
47 | + fontSize: 25, | ||
70 | ), | 48 | ), |
71 | - Text( | ||
72 | - 'total_recovered'.tr, | ||
73 | - style: TextStyle( | ||
74 | - fontSize: 25, | ||
75 | - ), | 49 | + ), |
50 | + Text( | ||
51 | + '${country.totalConfirmed}', | ||
52 | + style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | ||
53 | + ), | ||
54 | + SizedBox( | ||
55 | + height: 10, | ||
56 | + ), | ||
57 | + Text( | ||
58 | + 'total_deaths'.tr, | ||
59 | + style: TextStyle( | ||
60 | + fontSize: 25, | ||
76 | ), | 61 | ), |
77 | - Text( | ||
78 | - '${country.totalRecovered}', | ||
79 | - style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | 62 | + ), |
63 | + Text( | ||
64 | + '${country.totalDeaths}', | ||
65 | + style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | ||
66 | + ), | ||
67 | + SizedBox( | ||
68 | + height: 10, | ||
69 | + ), | ||
70 | + Text( | ||
71 | + 'total_recovered'.tr, | ||
72 | + style: TextStyle( | ||
73 | + fontSize: 25, | ||
80 | ), | 74 | ), |
81 | - TextButton( | ||
82 | - onPressed: () { | ||
83 | - Get.back(result: 'djsoidjsoidj'); | ||
84 | - }, | ||
85 | - child: Text('back')) | ||
86 | - ], | ||
87 | - )), | ||
88 | - ), | 75 | + ), |
76 | + Text( | ||
77 | + '${country.totalRecovered}', | ||
78 | + style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | ||
79 | + ), | ||
80 | + TextButton( | ||
81 | + onPressed: () { | ||
82 | + Get.back(result: 'djsoidjsoidj'); | ||
83 | + }, | ||
84 | + child: Text('back')) | ||
85 | + ], | ||
86 | + )), | ||
89 | ), | 87 | ), |
90 | ), | 88 | ), |
91 | ); | 89 | ); |
@@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev | @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev | ||
18 | version: 1.0.0+1 | 18 | version: 1.0.0+1 |
19 | 19 | ||
20 | environment: | 20 | environment: |
21 | - sdk: ">=2.12.0 <3.0.0" | 21 | + sdk: ">=2.19.1 <3.0.0" |
22 | 22 | ||
23 | dependency_overrides: | 23 | dependency_overrides: |
24 | get: | 24 | get: |
example/test/widget_test.dart
0 → 100644
1 | +// This is a basic Flutter widget test. | ||
2 | +// | ||
3 | +// To perform an interaction with a widget in your test, use the WidgetTester | ||
4 | +// utility in the flutter_test package. For example, you can send tap and scroll | ||
5 | +// gestures. You can also use WidgetTester to find child widgets in the widget | ||
6 | +// tree, read text, and verify that the values of widget properties are correct. | ||
7 | + | ||
8 | +import 'package:flutter/material.dart'; | ||
9 | +import 'package:flutter_test/flutter_test.dart'; | ||
10 | +import 'package:get_demo/main.dart'; | ||
11 | + | ||
12 | +void main() { | ||
13 | + testWidgets('Counter increments smoke test', (WidgetTester tester) async { | ||
14 | + // Build our app and trigger a frame. | ||
15 | + await tester.pumpWidget(const MyApp()); | ||
16 | + | ||
17 | + // Verify that our counter starts at 0. | ||
18 | + expect(find.text('0'), findsOneWidget); | ||
19 | + expect(find.text('1'), findsNothing); | ||
20 | + | ||
21 | + // Tap the '+' icon and trigger a frame. | ||
22 | + await tester.tap(find.byIcon(Icons.add)); | ||
23 | + await tester.pump(); | ||
24 | + | ||
25 | + // Verify that our counter has incremented. | ||
26 | + expect(find.text('0'), findsNothing); | ||
27 | + expect(find.text('1'), findsOneWidget); | ||
28 | + }); | ||
29 | +} |
@@ -15,7 +15,7 @@ dependencies: | @@ -15,7 +15,7 @@ dependencies: | ||
15 | dev_dependencies: | 15 | dev_dependencies: |
16 | flutter_test: | 16 | flutter_test: |
17 | sdk: flutter | 17 | sdk: flutter |
18 | - lints: ^1.0.1 | 18 | + lints: ^2.0.1 |
19 | 19 | ||
20 | 20 | ||
21 | # For information on the generic Dart part of this file, see the | 21 | # For information on the generic Dart part of this file, see the |
-
Please register or login to post a comment