Skip to content

Commit

Permalink
#134-Create-new-home-design (#237)
Browse files Browse the repository at this point in the history
* Basic Layout without Thumbnail done

* Display last lecture

TODO: somehow livenow never true (since streams are always empty)

* Add course card styling

- shadow
- correct corners
- outline

* Correct Shadow

* Display term, year in course card

* Add round icon, modify background and constraints

* Fix linting

* Livenow stream functionality

Still TODO: styling

* Add minimal styling

* Remove ViewAll for livecourses

future alternative: add LiveStream page to navigate to

* Styling

of
 -coursetitle and
- lineHeight

* Fix course_card

* Remove old livenow section

* Remove preview for publicCourses

* Add pulsing live

and
- image for mycourses
- viewCount
- roomnumber

todo:
- add redirect for room number
- icons/ colors for courses

removed settings hamburger menu for now

* Add redirect, fix background color

* Add scaling colored line

* Make border compatible with darkmode

* Add color picker

* Call the lastest stream

Problem: somehow this is empty

* Add URL launcher

* Fix linting

* Fix base light blue color on scrolling

* Bare minimum for course list view

* Add location image

* Fix expanded error

* Re-fix location aligning

* Livenow displayed correctly

* Fix linting

* Add navigation to course detail view

* Let livenow container hug content

* Refactor course section

* Refactor course card

* Pass lastLecture as lectureID

* Make lastLecture redirect

* Fix 'Don't use 'BuildContext's across async gaps.'

* Handle unmounted error

* Add null check for fetching lastLecture

Problem: fetching does not return stream correctly (a problem everywhere)

* Add rudimentary differentiation for Tablets

* Fix list view

* Add static progress bar

* Add functionality to progress

* Add stream length and date

* Make compatible with darkmode

* Commit before dev merge

* fix flutter dependencies

* Fix linting

* Avoid possible overflow error

* Fix lauchUrl on ios

* Add padding to downloads and pinns

* Fix padding for ipads

* Clean up comments, ..

- remove comments
- remove TODOS
- resolve error for course placeholder

* Redo merge stuff

* Add settings redirects

* Redo stream parameters

* Fix linting

* Remove thrown error

* Create folder `download_state_model`

* Remove comment

* Add shadow to the `BaseCard`

* Fix `progress` in stream card

---------

Co-authored-by: Achraf Labidi <[email protected]>
Co-authored-by: Achraf Labidi <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2024
1 parent cbef0f3 commit b2b1de2
Show file tree
Hide file tree
Showing 26 changed files with 1,169 additions and 350 deletions.
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
8 changes: 7 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ PODS:
- FlutterMacOS
- uni_links (0.0.1):
- Flutter
- url_launcher_ios (0.0.1):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
Expand All @@ -97,6 +99,7 @@ DEPENDENCIES:
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
Expand Down Expand Up @@ -133,6 +136,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
uni_links:
:path: ".symlinks/plugins/uni_links/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
wakelock_plus:
Expand Down Expand Up @@ -160,10 +165,11 @@ SPEC CHECKSUMS:
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
PODFILE CHECKSUM: 7be2f5f74864d463a8ad433546ed1de7e0f29aef

COCOAPODS: 1.14.3
112 changes: 56 additions & 56 deletions ios/Runner.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
File renamed without changes.
13 changes: 12 additions & 1 deletion lib/providers.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:fixnum/fixnum.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gocast_mobile/config/app_config.dart';
Expand All @@ -13,8 +14,9 @@ import 'package:gocast_mobile/view_models/download_view_model.dart';
import 'package:gocast_mobile/view_models/setting_view_model.dart';
import 'package:gocast_mobile/view_models/stream_view_model.dart';
import 'package:gocast_mobile/view_models/user_view_model.dart';
import 'base/networking/api/gocast/api_v2.pb.dart';
import 'base/networking/api/handler/grpc_handler.dart';
import 'models/download_state_model.dart';
import 'models/download/download_state_model.dart';
import 'models/video/stream_state_model.dart';

final grpcHandlerProvider =
Expand Down Expand Up @@ -58,3 +60,12 @@ final settingViewModelProvider =
StateNotifierProvider<SettingViewModel, SettingState>((ref) {
return SettingViewModel(ref.watch(grpcHandlerProvider));
});

final progressProvider = FutureProvider.autoDispose.family<Progress, Int64>(
(ref, streamId) async {
final videoViewModel = ref.watch(videoViewModelProvider.notifier);
return videoViewModel.fetchProgressForStream(streamId);
},
);


2 changes: 1 addition & 1 deletion lib/view_models/download_view_model.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'dart:convert';
import 'package:fixnum/fixnum.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gocast_mobile/models/download/download_state_model.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:path_provider/path_provider.dart';
import 'package:dio/dio.dart';
import 'package:logger/logger.dart';
import 'dart:io';
import '../models/download_state_model.dart';

class DownloadViewModel extends StateNotifier<DownloadState> {
final Logger _logger = Logger();
Expand Down
10 changes: 10 additions & 0 deletions lib/view_models/stream_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ class StreamViewModel extends StateNotifier<StreamState> {
}
}

Future<Progress> fetchProgressForStream(Int64 streamId) async {
try {
final progress =
await StreamHandler(_grpcHandler).fetchProgress(streamId);
return progress;
} catch (e) {
return Progress(progress: 0.0);
}
}

Future<void> updateProgress(Int64 streamId, Progress progress) async {
_logger.i('Updating progress');
state = state.copyWith(isLoading: true);
Expand Down
1 change: 1 addition & 0 deletions lib/views/components/base_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class BaseViewState extends ConsumerState<BaseView> {
),
]
: widget.actions,
surfaceTintColor: Colors.transparent,
),
body: widget.child,
drawer: !_isTablet(context) && widget.customAppBar==null ? _buildHamburgerMenu(context) : null,
Expand Down
25 changes: 21 additions & 4 deletions lib/views/components/view_all_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,37 @@ import 'package:flutter/material.dart';

class ViewAllButton extends StatelessWidget {
final VoidCallback? onViewAll;
final IconData? icon;
final String? text;

const ViewAllButton({
super.key,
required this.onViewAll,
this.icon,
this.text,
});

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onViewAll,
child: Icon(
Icons.arrow_forward_ios,
size: 25,
color: Theme.of(context).iconTheme.color,
child: Row(
children: [
Text(
text ?? "",
style: TextStyle(
color: Colors.grey[600],
fontSize: 12.0,
decoration: TextDecoration.underline,
),
),
const SizedBox(width: 5),
Icon(
icon ?? Icons.arrow_forward_ios,
size: icon == null ? 25 : 15,
color: Theme.of(context).iconTheme.color,
),
],
),
);
}
Expand Down
29 changes: 17 additions & 12 deletions lib/views/course_view/components/base_card.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:gocast_mobile/utils/theme.dart';

class BaseCard extends StatelessWidget {
final String imageName;

final VoidCallback onTap;

const BaseCard({
Expand All @@ -13,19 +13,22 @@ class BaseCard extends StatelessWidget {

@override
Widget build(BuildContext context) {
ThemeData themeData = Theme.of(context);

return InkWell(
onTap: onTap,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
elevation: 5,
color: themeData.cardTheme.color,
shadowColor: themeData.shadowColor,
clipBehavior: Clip.antiAlias,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
...buildCardContent(), // Call to the overridable method
const Padding(
padding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 12.0),
),
],
children: buildCardContent(),
),
),
);
Expand All @@ -43,26 +46,28 @@ class BaseCard extends StatelessWidget {
Widget? trailing,
}) {
return Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 16.0,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: appTheme.cardTheme.color,
),
maxLines: 2,
),
const SizedBox(height: 8.0),
Text(
subtitle,
style: const TextStyle(fontSize: 14.0, color: Colors.grey),
style: TextStyle(fontSize: 14.0, color: Colors.grey[600]),
),
],
),
Expand Down Expand Up @@ -101,7 +106,7 @@ class BaseCard extends StatelessWidget {
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Image.asset(
'assets/images/default_image.png',
'assets/images/course1.png',
fit: BoxFit.cover,
);
},
Expand Down
Loading

0 comments on commit b2b1de2

Please sign in to comment.