From b5a13a2b988cef824c006f91aa604f50dab4ac0a Mon Sep 17 00:00:00 2001 From: Reza Farjam Date: Wed, 4 Oct 2023 01:20:57 +0330 Subject: [PATCH] Revert "Changed to canvaskit web render" This reverts commit 27d2be479595a5dfc3737a74b4353e42c90b5cae. --- .github/workflows/deploy.yaml | 2 +- lib/app/views/professor.dart | 64 ++++++++++++----------------- lib/app/views/reference.dart | 59 +++++++++++--------------- lib/app/widgets/professor_card.dart | 51 ++++++++++------------- lib/app/widgets/reference_card.dart | 51 ++++++++++------------- pubspec.lock | 60 +-------------------------- pubspec.yaml | 1 - 7 files changed, 98 insertions(+), 190 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 6846f1b..0975754 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -30,7 +30,7 @@ jobs: # CI is set to false to prevent treating warnings as errors - name: Build Flutter for Web - run: CI=false flutter build web --web-renderer canvaskit --release --no-tree-shake-icons + run: CI=false flutter build web --web-renderer html --release --no-tree-shake-icons - name: Run Post-Build Script run: | diff --git a/lib/app/views/professor.dart b/lib/app/views/professor.dart index 83b2798..1d5ba15 100644 --- a/lib/app/views/professor.dart +++ b/lib/app/views/professor.dart @@ -15,7 +15,6 @@ import 'package:cse_archive/app/widgets/header.dart'; import 'package:cse_archive/app/widgets/gap.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:image_network/image_network.dart'; import 'package:url_launcher/link.dart'; import 'loading.dart'; @@ -35,48 +34,39 @@ class ProfessorView extends GetView { Widget build(BuildContext context) { return controller.obx( (_) { - const imageSize = 17 * kSizeDefault; - - final imageBorderRadius = BorderRadius.circular(kSizeDefault / 2); - - final noImage = DecoratedBox( - decoration: BoxDecoration( - borderRadius: imageBorderRadius, - border: Border.all( - width: 4, - color: context.primaryColor, - ), - ), - child: Center( - child: Icon( - ArchiveIcons.photoOff, - size: 5 * kSizeDefault, - color: context.primaryColor, - ), - ), + final departmentLabel = ArchiveLabel( + title: ArchiveStrings.professorDepartment, + value: controller.professor!.department.representation, ); final image = ArchiveCard( - width: imageSize, - height: imageSize, + width: 17 * kSizeDefault, + height: 17 * kSizeDefault, onPressed: null, child: (controller.professor!.image != null) - ? ImageNetwork( - duration: 0, - width: imageSize, - height: imageSize, - borderRadius: imageBorderRadius, - image: controller.professor!.image.toString(), - onError: noImage, - onLoading: - CircularProgressIndicator(color: context.primaryColor), + ? ClipRRect( + borderRadius: BorderRadius.circular(kSizeDefault / 2), + child: Image.network( + controller.professor!.image.toString(), + fit: BoxFit.cover, + ), ) - : noImage, - ); - - final departmentLabel = ArchiveLabel( - title: ArchiveStrings.professorDepartment, - value: controller.professor!.department.representation, + : DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(kSizeDefault / 2), + border: Border.all( + width: 4, + color: context.primaryColor, + ), + ), + child: Center( + child: Icon( + ArchiveIcons.photoOff, + size: 5 * kSizeDefault, + color: context.primaryColor, + ), + ), + ), ); final nameColumn = Align( diff --git a/lib/app/views/reference.dart b/lib/app/views/reference.dart index c61f0cf..094b265 100644 --- a/lib/app/views/reference.dart +++ b/lib/app/views/reference.dart @@ -17,7 +17,6 @@ import 'package:cse_archive/app/widgets/path.dart'; import 'package:cse_archive/app/widgets/web_page/web_page.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:image_network/image_network.dart'; import 'package:url_launcher/link.dart'; import 'loading.dart'; @@ -39,44 +38,34 @@ class ReferenceView extends GetView { (_) { final reference = controller.reference!; - const imageWidth = 17 * kSizeDefault; - const imageHeight = 20 * kSizeDefault; - - final imageBorderRadius = BorderRadius.circular(kSizeDefault / 2); - - final noImage = DecoratedBox( - decoration: BoxDecoration( - borderRadius: imageBorderRadius, - border: Border.all( - width: 4, - color: context.primaryColor, - ), - ), - child: Center( - child: Icon( - ArchiveIcons.photoOff, - size: 5 * kSizeDefault, - color: context.primaryColor, - ), - ), - ); - final image = ArchiveCard( onPressed: null, - width: imageWidth, - height: imageHeight, + width: 17 * kSizeDefault, + height: 20 * kSizeDefault, child: (reference.image != null) - ? ImageNetwork( - duration: 0, - width: imageWidth, - height: imageHeight, - borderRadius: imageBorderRadius, - image: reference.image.toString(), - onError: noImage, - onLoading: - CircularProgressIndicator(color: context.primaryColor), + ? ClipRRect( + borderRadius: BorderRadius.circular(kSizeDefault / 2), + child: Image.network( + reference.image.toString(), + fit: BoxFit.cover, + ), ) - : noImage, + : DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(kSizeDefault / 2), + border: Border.all( + width: 4, + color: context.primaryColor, + ), + ), + child: Center( + child: Icon( + ArchiveIcons.photoOff, + size: 5 * kSizeDefault, + color: context.primaryColor, + ), + ), + ), ); final typeLabel = ArchiveLabel( diff --git a/lib/app/widgets/professor_card.dart b/lib/app/widgets/professor_card.dart index 3f6c59f..d599297 100644 --- a/lib/app/widgets/professor_card.dart +++ b/lib/app/widgets/professor_card.dart @@ -7,7 +7,6 @@ import 'package:cse_archive/app/models/professor.dart'; import 'package:cse_archive/app/routes/routes.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:image_network/image_network.dart'; import 'gap.dart'; import 'card.dart'; @@ -24,23 +23,6 @@ class ArchiveProfessorCard extends StatelessWidget { @override Widget build(BuildContext context) { - const imageSize = 6 * kSizeDefault; - - final noImage = Container( - width: imageSize, - height: imageSize, - decoration: BoxDecoration( - border: Border.all(color: context.secondaryColor), - ), - child: Center( - child: Icon( - ArchiveIcons.photoOff, - size: 2 * kSizeDefault, - color: context.secondaryColor, - ), - ), - ); - return ArchiveCard( width: width, color: context.primaryColor, @@ -75,17 +57,28 @@ class ArchiveProfessorCard extends StatelessWidget { ), ), const Gap.horizontal(kSizeDefault), - (professor.image != null) - ? ImageNetwork( - duration: 0, - width: imageSize, - height: imageSize, - image: professor.image.toString(), - onError: noImage, - onLoading: - CircularProgressIndicator(color: context.secondaryColor), - ) - : noImage, + Container( + width: 6 * kSizeDefault, + height: 6 * kSizeDefault, + decoration: BoxDecoration( + image: (professor.image != null) + ? DecorationImage( + image: NetworkImage(professor.image.toString()), + fit: BoxFit.cover, + ) + : null, + border: Border.all(color: context.secondaryColor), + ), + child: (professor.image != null) + ? null + : Center( + child: Icon( + ArchiveIcons.photoOff, + size: 2 * kSizeDefault, + color: context.secondaryColor, + ), + ), + ), ], ), ); diff --git a/lib/app/widgets/reference_card.dart b/lib/app/widgets/reference_card.dart index 850cd5b..a0c7326 100644 --- a/lib/app/widgets/reference_card.dart +++ b/lib/app/widgets/reference_card.dart @@ -6,7 +6,6 @@ import 'package:cse_archive/app/models/reference.dart'; import 'package:cse_archive/app/routes/routes.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; -import 'package:image_network/image_network.dart'; import 'gap.dart'; import 'card.dart'; @@ -23,23 +22,6 @@ class ArchiveReferenceCard extends StatelessWidget { @override Widget build(BuildContext context) { - const imageSize = 6 * kSizeDefault; - - final noImage = Container( - width: imageSize, - height: imageSize, - decoration: BoxDecoration( - border: Border.all(color: context.secondaryColor), - ), - child: Center( - child: Icon( - ArchiveIcons.photoOff, - size: 2 * kSizeDefault, - color: context.secondaryColor, - ), - ), - ); - return ArchiveCard( width: width, color: context.primaryColor, @@ -82,17 +64,28 @@ class ArchiveReferenceCard extends StatelessWidget { ), ), const Gap.horizontal(kSizeDefault), - (reference.image != null) - ? ImageNetwork( - duration: 0, - width: imageSize, - height: imageSize, - image: reference.image.toString(), - onError: noImage, - onLoading: - CircularProgressIndicator(color: context.secondaryColor), - ) - : noImage, + Container( + width: 6 * kSizeDefault, + height: 6 * kSizeDefault, + decoration: BoxDecoration( + image: (reference.image != null) + ? DecorationImage( + image: NetworkImage(reference.image.toString()), + fit: BoxFit.cover, + ) + : null, + border: Border.all(color: context.secondaryColor), + ), + child: (reference.image != null) + ? null + : Center( + child: Icon( + ArchiveIcons.photoOff, + size: 2 * kSizeDefault, + color: context.secondaryColor, + ), + ), + ), ], ), ); diff --git a/pubspec.lock b/pubspec.lock index 18efd66..677e8ca 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -181,14 +181,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" - image_network: - dependency: "direct main" - description: - name: image_network - sha256: "49198112851e48e9f38a44016df4f97a8db3fbfe9ae0c2d1aafa87ba9dcddec8" - url: "https://pub.dev" - source: hosted - version: "2.5.4+1" intl: dependency: "direct main" description: @@ -317,14 +309,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.5" - pointer_interceptor: - dependency: transitive - description: - name: pointer_interceptor - sha256: "7626e034489820fd599380d2bb4d3f4a0a5e3529370b62bfce53ab736b91adb2" - url: "https://pub.dev" - source: hosted - version: "0.9.3+6" rive: dependency: "direct main" description: @@ -586,46 +570,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.4-beta" - webview_flutter: - dependency: transitive - description: - name: webview_flutter - sha256: c1ab9b81090705c6069197d9fdc1625e587b52b8d70cdde2339d177ad0dbb98e - url: "https://pub.dev" - source: hosted - version: "4.4.1" - webview_flutter_android: - dependency: transitive - description: - name: webview_flutter_android - sha256: b0cd33dd7d3dd8e5f664e11a19e17ba12c352647269921a3b568406b001f1dff - url: "https://pub.dev" - source: hosted - version: "3.12.0" - webview_flutter_platform_interface: - dependency: transitive - description: - name: webview_flutter_platform_interface - sha256: "6d9213c65f1060116757a7c473247c60f3f7f332cac33dc417c9e362a9a13e4f" - url: "https://pub.dev" - source: hosted - version: "2.6.0" - webview_flutter_wkwebview: - dependency: transitive - description: - name: webview_flutter_wkwebview - sha256: "30b9af6bdd457b44c08748b9190d23208b5165357cc2eb57914fee1366c42974" - url: "https://pub.dev" - source: hosted - version: "3.9.1" - webviewimage: - dependency: transitive - description: - name: webviewimage - sha256: f6da2a7bfc3e67f330e8551c13c10a16aa3100a0d46e44c5484978a63ca5d62d - url: "https://pub.dev" - source: hosted - version: "0.0.4" win32: dependency: transitive description: @@ -651,5 +595,5 @@ packages: source: hosted version: "6.3.0" sdks: - dart: ">=3.1.0 <4.0.0" - flutter: ">=3.13.0" + dart: ">=3.1.0-185.0.dev <4.0.0" + flutter: ">=3.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index 0a8c933..6873cc2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,7 +22,6 @@ dependencies: flutter_svg: ^2.0.7 get: ^4.6.5 go_router: ^10.1.0 - image_network: ^2.5.4+1 intl: ^0.18.0 rive: ^0.11.14 sentry_flutter: ^7.10.1