From 0c6144d469e66c57b6f6af48b6e3c9a2ceb7569c Mon Sep 17 00:00:00 2001 From: ErnestoMoraes Date: Tue, 14 Mar 2023 08:46:26 -0300 Subject: [PATCH 1/6] Tirando Problems --- lib/app/pages/home/home_page.dart | 2 -- lib/app/pages/login/login_page.dart | 4 +++- lib/app/pages/schedule/schedule_page.dart | 4 +--- lib/app/pages/schedule/widgets/line_days.dart | 2 +- lib/app/repositories/schedule/schedule_repository.dart | 4 +--- lib/app/repositories/schedule/schedule_repository_impl.dart | 3 +-- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/app/pages/home/home_page.dart b/lib/app/pages/home/home_page.dart index b34bd12..0071732 100644 --- a/lib/app/pages/home/home_page.dart +++ b/lib/app/pages/home/home_page.dart @@ -1,5 +1,3 @@ -import 'dart:ffi'; - import 'package:academico_mobile/app/core/ui/helpers/size_extensions.dart'; import 'package:academico_mobile/app/core/ui/styles/colors_app.dart'; import 'package:academico_mobile/app/core/ui/styles/text_styles.dart'; diff --git a/lib/app/pages/login/login_page.dart b/lib/app/pages/login/login_page.dart index 74bb0d3..5a9ea35 100644 --- a/lib/app/pages/login/login_page.dart +++ b/lib/app/pages/login/login_page.dart @@ -84,7 +84,9 @@ class _LoginPageState extends State { child: MyInputButton( height: context.percentHeight(.15), label: 'Acessar', - onPressed: () {}, + onPressed: () { + Navigator.of(context).pushNamed('/home'); + }, ), ), ], diff --git a/lib/app/pages/schedule/schedule_page.dart b/lib/app/pages/schedule/schedule_page.dart index 9181297..8653e76 100644 --- a/lib/app/pages/schedule/schedule_page.dart +++ b/lib/app/pages/schedule/schedule_page.dart @@ -2,8 +2,6 @@ import 'package:academico_mobile/app/core/ui/helpers/size_extensions.dart'; import 'package:academico_mobile/app/core/ui/widgets/my_card.dart'; import 'package:academico_mobile/app/pages/schedule/widgets/line_days.dart'; import 'package:flutter/material.dart'; - -import '../../core/ui/styles/colors_app.dart'; import '../../core/ui/styles/text_styles.dart'; class SchedulePage extends StatelessWidget { @@ -11,7 +9,7 @@ class SchedulePage extends StatelessWidget { @override Widget build(BuildContext context) { - bool isNow = true; + // bool isNow = true; List days = [ 'Dom', 'Seg', diff --git a/lib/app/pages/schedule/widgets/line_days.dart b/lib/app/pages/schedule/widgets/line_days.dart index 166858c..68d3102 100644 --- a/lib/app/pages/schedule/widgets/line_days.dart +++ b/lib/app/pages/schedule/widgets/line_days.dart @@ -33,7 +33,7 @@ class LineDays extends StatelessWidget { ), ), onPressed: nameDay == 'Dom' || nameDay == 'Sab' ? null : () { - print('Clicou no dia $nameDay'); + // print('Clicou no dia $nameDay'); }, child: SizedBox( height: context.percentHeight(.2), diff --git a/lib/app/repositories/schedule/schedule_repository.dart b/lib/app/repositories/schedule/schedule_repository.dart index a922e20..b218f27 100644 --- a/lib/app/repositories/schedule/schedule_repository.dart +++ b/lib/app/repositories/schedule/schedule_repository.dart @@ -1,9 +1,7 @@ // ignore_for_file: public_member_api_docs, sort_constructors_first -import 'package:academico_mobile/app/models/schedule_model.dart'; +// import 'package:academico_mobile/app/models/schedule_model.dart'; abstract class ScheduleRepository { Future findSchedule(); } - - diff --git a/lib/app/repositories/schedule/schedule_repository_impl.dart b/lib/app/repositories/schedule/schedule_repository_impl.dart index 02e36c1..0e7c512 100644 --- a/lib/app/repositories/schedule/schedule_repository_impl.dart +++ b/lib/app/repositories/schedule/schedule_repository_impl.dart @@ -1,5 +1,4 @@ -import 'package:academico_mobile/app/core/config/env/env.dart'; -import 'package:academico_mobile/app/core/exceptions/repository_exceptions.dart'; + import 'package:academico_mobile/app/core/rest_client/custom_webview.dart'; import './schedule_repository.dart'; From 403eec2ced230852b39f3cdd0afacb9abcceecbc Mon Sep 17 00:00:00 2001 From: ErnestoMoraes Date: Tue, 14 Mar 2023 08:47:01 -0300 Subject: [PATCH 2/6] CD --- .github/workflows/ci-cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 7b00e29..25ff19c 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -50,9 +50,9 @@ jobs: channel: "stable" - run: flutter pub get - run: flutter clean - - run: flutter build appbundle - - name: Upload appbundle + - run: flutter build apk + - name: Upload apk uses: actions/upload-artifact@v3 with: name: appbundle - path: build/app/outputs/bundle/release/app-release.aab \ No newline at end of file + path: build/app/outputs/bundle/release/app-release.apk \ No newline at end of file From b4fb0f9562db84fdf1bbfaf1129ceb7fec9a3458 Mon Sep 17 00:00:00 2001 From: ErnestoMoraes Date: Tue, 14 Mar 2023 08:53:42 -0300 Subject: [PATCH 3/6] substituindo flutter format -> dart format --- .github/workflows/ci-cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 25ff19c..4b47469 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -21,8 +21,8 @@ jobs: - run: flutter --version - run: flutter pub get - run: flutter analyze - - run: flutter format --dry-run --set-exit-if-changed lib/ - - run: flutter format --dry-run --set-exit-if-changed test/ + - run: dart format --dry-run --set-exit-if-changed lib/ + - run: dart format --dry-run --set-exit-if-changed test/ - run: flutter test --coverage - run: flutter test --machine > test-results.json - uses: actions/upload-artifact@v3 # upload test results From 4a91d4c794c6969cf81d50af3cd108ab7bf9a6ec Mon Sep 17 00:00:00 2001 From: ErnestoMoraes Date: Tue, 14 Mar 2023 09:00:08 -0300 Subject: [PATCH 4/6] substituindo flutter format -> dart format --- .github/workflows/ci-cd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 4b47469..e911afa 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -21,8 +21,7 @@ jobs: - run: flutter --version - run: flutter pub get - run: flutter analyze - - run: dart format --dry-run --set-exit-if-changed lib/ - - run: dart format --dry-run --set-exit-if-changed test/ + - run: dart format . - run: flutter test --coverage - run: flutter test --machine > test-results.json - uses: actions/upload-artifact@v3 # upload test results From bca54374c41fac2a7339343162bdc3033b0e4bf2 Mon Sep 17 00:00:00 2001 From: ErnestoMoraes Date: Tue, 14 Mar 2023 09:02:59 -0300 Subject: [PATCH 5/6] substituindo flutter format -> dart format * dessa vez na pasta certa: ci.yml --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 684afd8..799420e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,7 @@ jobs: - run: flutter --version - run: flutter pub get - run: flutter analyze - - run: flutter format --dry-run --set-exit-if-changed lib/ - - run: flutter format --dry-run --set-exit-if-changed test/ + - run: dart format . - run: flutter test --coverage - run: flutter test --machine > test-results.json - uses: actions/upload-artifact@v3 # upload test results From 0caa2fefa01e7afdf78ab3d7f3fa7ed45bbb4fd9 Mon Sep 17 00:00:00 2001 From: ErnestoMoraes Date: Tue, 14 Mar 2023 09:10:10 -0300 Subject: [PATCH 6/6] testes default - desconciderar --- lib/main.dart | 113 ++++++++++++++++++++++++++++++++++++++++++ test/widget_test.dart | 30 +++++++++++ 2 files changed, 143 insertions(+) create mode 100644 test/widget_test.dart diff --git a/lib/main.dart b/lib/main.dart index 9df3fb9..4f019ff 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,3 +6,116 @@ Future main() async { await Env.instance.load(); runApp(const AcademicoMobile()); } + + +//! Código para testes!!!! Apenas para testes!!!! + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or simply save your changes to "hot reload" in a Flutter IDE). + // Notice that the counter didn't reset back to zero; the application + // is not restarted. + primarySwatch: Colors.blue, + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({super.key, required this.title}); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug painting" (press "p" in the console, choose the + // "Toggle Debug Paint" action from the Flutter Inspector in Android + // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) + // to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme.of(context).textTheme.headlineMedium, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..28f15c9 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:academico_mobile/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}