Skip to content

Commit

Permalink
FinishTesting
Browse files Browse the repository at this point in the history
  • Loading branch information
victor7w7r committed Jul 3, 2024
1 parent 69ebfe4 commit f4e09e4
Show file tree
Hide file tree
Showing 28 changed files with 1,078 additions and 240 deletions.
2 changes: 1 addition & 1 deletion coverage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

flutter test --coverage
lcov --remove coverage/lcov.info 'lib/generated/*' -o coverage/new_lcov.info
dart run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '\.g\.dart$'
genhtml coverage/lcov.info -o coverage/html
open coverage/html/index.html
18 changes: 9 additions & 9 deletions lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ final class App extends StatelessWidget {
LUViewModel<Platform, DesktopService>(
builder: (final pt, final ctl) {
if (pt.isIos()) {
return child ?? const CupertinoLayout();
return CupertinoLayout(child: child);
} else if (pt.isAndroid()) {
return const MaterialLayout();
} else if (pt.isDesktop() && ctl.state != 'none') {
if (ctl.state == 'material') {
return const MaterialLayout();
} else if (ctl.state == 'cupertino') {
return const CupertinoLayout();
return MaterialLayout(child: child);
} else if (pt.isDesktop() && ctl.state() != 'none') {
if (ctl.state() == 'material') {
return MaterialLayout(child: child);
} else if (ctl.state() == 'cupertino') {
return CupertinoLayout(child: child);
} else {
return const FluentLayout();
return FluentLayout(child: child);
}
} else {
return const DesktopSelectorPage();
return DesktopSelectorPage(child: child);
}
},
);
Expand Down
1 change: 1 addition & 0 deletions lib/core/di/inject.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore_for_file: always_use_package_imports
// coverage:ignore-file

import 'package:get_it/get_it.dart' show GetIt;
import 'package:injectable/injectable.dart' show InjectableInit;
Expand Down
16 changes: 0 additions & 16 deletions lib/core/utils/errors.dart

This file was deleted.

2 changes: 2 additions & 0 deletions lib/core/utils/platforms.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// coverage:ignore-file

import 'package:flutter/foundation.dart'
show TargetPlatform, defaultTargetPlatform, kIsWeb;

Expand Down
1 change: 0 additions & 1 deletion lib/core/utils/utils.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export 'errors.dart';
export 'mvvm.dart';
export 'platforms.dart';
export 'query.dart';
2 changes: 1 addition & 1 deletion lib/features/common/ui/services/desktop_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class DesktopService extends ChangeNotifier {
notifyListeners();
}

String get state => _state;
String state() => _state;
}
26 changes: 17 additions & 9 deletions lib/features/fluent/ui/pages/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import 'package:flutterfly/features/fluent/ui/services/fluent_service.dart';
import 'package:flutterfly/features/fluent/ui/widgets/widgets.dart';

class HomePage extends StatelessWidget {
const HomePage({super.key, this.child});
const HomePage({super.key, this.child, this.secondMockChild});

final Widget? child;
final Widget? secondMockChild;

Color _background() =>
inject.get<FluentService>().state().isDark ? Colors.white : Colors.black;
Expand Down Expand Up @@ -85,23 +86,30 @@ class HomePage extends StatelessWidget {
color: ctl.state().themeColor.first,
child: n.Column([
if (!inject.get<Platform>().isWeb())
WindowTitleBar(isDark: ctl.state().isDark),
WindowTitleBar(
isDark: ctl.state().isDark,
child: secondMockChild,
),
const SizedBox(height: 10),
const Header(),
Header(child: secondMockChild),
context.mWidth > 960
? SizedBox(
height: context.mHeight <= 700 ? 40 : context.mHeight / 15,
)
: const SizedBox(height: 20),
n.Column([
context.mWidth > 960
? (n.Row(const [HomeCardBrand(), HomeCardCrypto()])
..mainAxisAlignment = MainAxisAlignment.spaceEvenly)
? (n.Row(
[
HomeCardBrand(child: secondMockChild),
HomeCardCrypto(child: secondMockChild),
],
)..mainAxisAlignment = MainAxisAlignment.spaceEvenly)
: (n.Column(
const [
HomeCardBrand(),
SizedBox(height: 30),
HomeCardCrypto(),
[
HomeCardBrand(child: secondMockChild),
const SizedBox(height: 30),
HomeCardCrypto(child: secondMockChild),
],
)..mainAxisAlignment = MainAxisAlignment.spaceEvenly),
const SizedBox(height: 40),
Expand Down
21 changes: 16 additions & 5 deletions lib/features/fluent/ui/pages/home/home_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ final class ColorButton extends StatelessWidget {
@override
Widget build(final BuildContext context) => Button(
style: ButtonStyle(
elevation: ButtonState.all<double>(0),
backgroundColor: ButtonState.all<Color>(back),
shape: ButtonState.all<CircleBorder>(
elevation: WidgetStateProperty.all<double>(0),
backgroundColor: WidgetStateProperty.all<Color>(back),
shape: WidgetStateProperty.all<CircleBorder>(
CircleBorder(side: BorderSide(width: 4, color: border)),
),
),
Expand All @@ -35,12 +35,15 @@ final class ColorButton extends StatelessWidget {
}

final class HomeCardBrand extends StatelessWidget {
const HomeCardBrand({super.key});
const HomeCardBrand({super.key, this.child});

final Widget? child;

@override
Widget build(
final BuildContext context,
) =>
child ??
ListenViewModel<FluentService>(
builder: (final ctl) => Card(
backgroundColor: ctl.state().themeColor[1],
Expand Down Expand Up @@ -73,12 +76,17 @@ final class HomeCardBrand extends StatelessWidget {
}

final class HomeCardCrypto extends StatelessWidget {
const HomeCardCrypto({super.key});
const HomeCardCrypto({super.key, this.child, this.mockError = false});

final Widget? child;

final bool mockError;

@override
Widget build(
final BuildContext context,
) =>
child ??
ListenViewModel<FluentService>(
builder: (final ctl) => Card(
backgroundColor: ctl.state().themeColor[1],
Expand Down Expand Up @@ -107,12 +115,15 @@ final class HomeCardCrypto extends StatelessWidget {
def: Bitcoin.detached(),
ctlServ.getBitcoin,
loading: () => const ProgressRing(value: 35),
mockError: mockError,
error: (final _, final error) => n.Column(
[
const SizedBox(height: 120),
error == null
? ('An error occurred'.n..fontSize = 20)
// coverage:ignore-start
: (error.message.n..fontSize = 20),
// coverage:ignore-end
],
),
success: (final _, final data) => n.Column([
Expand Down
11 changes: 6 additions & 5 deletions lib/features/fluent/ui/widgets/blur_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ final class BlurButton extends StatelessWidget {
FilledButton(
onPressed: onClick,
style: ButtonStyle(
elevation: ButtonState.all<double>(0),
foregroundColor: ButtonState.all<Color>(Colors.black),
backgroundColor:
ButtonState.all<Color>(const Color.fromRGBO(255, 255, 255, 0.4)),
shape: ButtonState.all<RoundedRectangleBorder>(
elevation: WidgetStateProperty.all<double>(0),
foregroundColor: WidgetStateProperty.all<Color>(Colors.black),
backgroundColor: WidgetStateProperty.all<Color>(
const Color.fromRGBO(255, 255, 255, 0.4),
),
shape: WidgetStateProperty.all<RoundedRectangleBorder>(
const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(18.0)),
side: BorderSide(color: Color.fromRGBO(204, 204, 204, 0)),
Expand Down
4 changes: 1 addition & 3 deletions lib/features/fluent/ui/widgets/header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ final class Header extends StatelessWidget {
n.Image.asset('assets/flutter-logo.png')
..width = 50
..height = 30,
'Flutter Template'.n
..expanded
..color = ctl.state().themeColor[2],
'Flutter Template'.n..color = ctl.state().themeColor[2],
])
..pl = context.mWidth > 960 ? 200 : 50,
ToggleSwitch(
Expand Down
28 changes: 22 additions & 6 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,18 @@ packages:
dependency: "direct main"
description:
name: dio
sha256: "11e40df547d418cc0c4900a9318b26304e665da6fa4755399a9ff9efd09034b5"
sha256: "77befdddf51050e1635a04d2bcfff230089ce7294e642d00da58cd079c0de0c8"
url: "https://pub.dev"
source: hosted
version: "5.4.3+1"
version: "5.5.0"
dio_web_adapter:
dependency: transitive
description:
name: dio_web_adapter
sha256: "36c5b2d79eb17cdae41e974b7a8284fec631651d2a6f39a8a2ff22327e90aeac"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -365,10 +373,10 @@ packages:
dependency: "direct main"
description:
name: fluent_ui
sha256: a8c76cb501303d108cb9bd33e516da7cfd078031ff427d68eab6069bf4492a2c
sha256: "6f4200eab911f783c6bd7892569fdc1f85d77cef5b02fde24595ea5ce72f97c9"
url: "https://pub.dev"
source: hosted
version: "4.8.7"
version: "4.9.0"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -821,6 +829,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.0"
remove_from_coverage:
dependency: "direct dev"
description:
name: remove_from_coverage
sha256: "5b5745f6b692c80e3d7903fb83f9e789dc4575e6db5443a1b391ca25c10bad06"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
retrofit:
dependency: "direct main"
description:
Expand All @@ -833,10 +849,10 @@ packages:
dependency: "direct dev"
description:
name: retrofit_generator
sha256: a962be21403c2ecdd82d06c863340cff759642ae6ecac5a2c74a9a60377592c3
sha256: af46d19e82210850632e539b0d585dea8ed0c9a49b9ac6741306e19f8e83c90d
url: "https://pub.dev"
source: hosted
version: "8.1.0"
version: "8.1.1"
rxdart:
dependency: transitive
description:
Expand Down
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ dependencies:
bitsdojo_window: ^0.1.6
cupertino_icons: ^1.0.8
dart_mappable: ^4.2.2
dio: ^5.4.3+1
dio: ^5.5.0
fast_immutable_collections: ^10.2.4
fl_query: ^1.1.0
fluent_ui: ^4.8.7
fluent_ui: ^4.9.0
flutter:
sdk: flutter
flutter_native_splash: ^2.4.0
Expand All @@ -42,7 +42,8 @@ dev_dependencies:
path_provider_platform_interface: ^2.1.2
plugin_platform_interface: ^2.1.8
pyramid_lint: ^2.0.0
retrofit_generator: ^8.1.0
remove_from_coverage: ^2.0.0
retrofit_generator: ^8.1.1
source_gen: ^1.5.0

import_sorter:
Expand Down
66 changes: 0 additions & 66 deletions test/app_test

This file was deleted.

Loading

0 comments on commit f4e09e4

Please sign in to comment.