|
|
|
|
@ -14,6 +14,7 @@ import 'package:mohem_flutter_app/models/dashboard/courses_response_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/theme/colors.dart' as theme_colors;
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/sso_webview_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
|
|
|
|
|
@ -148,7 +149,7 @@ class _CoursesScreenState extends State<CoursesScreen> {
|
|
|
|
|
Color statusColor = _getStatusColor(status);
|
|
|
|
|
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () => _openCourse(course.cUrl ?? ''),
|
|
|
|
|
onTap: () => _openCourse(course.cUrl, course.token),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -291,33 +292,37 @@ class _CoursesScreenState extends State<CoursesScreen> {
|
|
|
|
|
return format.format(dateTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _openCourse(String url) {
|
|
|
|
|
if (url.isEmpty) {
|
|
|
|
|
Utils.showToast(LocaleKeys.courseUrlNotAvailable.tr());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void _openCourse(String? url, String? jwtToken) {
|
|
|
|
|
|
|
|
|
|
MyInAppBrowser browser = MyInAppBrowser(
|
|
|
|
|
onExitCallback: () {},
|
|
|
|
|
onLoadStartCallback: (String url) {},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
var settings = InAppBrowserClassSettings(
|
|
|
|
|
webViewSettings: InAppWebViewSettings(
|
|
|
|
|
useShouldOverrideUrlLoading: false,
|
|
|
|
|
transparentBackground: false,
|
|
|
|
|
),
|
|
|
|
|
browserSettings: InAppBrowserSettings(
|
|
|
|
|
hideUrlBar: true,
|
|
|
|
|
hideTitleBar: false,
|
|
|
|
|
toolbarTopBackgroundColor: theme_colors.primaryColor,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (BuildContext context) => SsoLoginWebView(url: url, jwtToken: jwtToken)));
|
|
|
|
|
//Utils.showToast(LocaleKeys.courseUrlNotAvailable.tr());
|
|
|
|
|
|
|
|
|
|
browser.openUrlRequest(
|
|
|
|
|
urlRequest: URLRequest(url: WebUri(url)),
|
|
|
|
|
settings: settings,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// MyInAppBrowser browser = MyInAppBrowser(
|
|
|
|
|
// onExitCallback: () {},
|
|
|
|
|
// onLoadStartCallback: (String url) {},
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// var settings = InAppBrowserClassSettings(
|
|
|
|
|
// webViewSettings: InAppWebViewSettings(
|
|
|
|
|
// useShouldOverrideUrlLoading: false,
|
|
|
|
|
// transparentBackground: false,
|
|
|
|
|
// ),
|
|
|
|
|
// browserSettings: InAppBrowserSettings(
|
|
|
|
|
// hideUrlBar: true,
|
|
|
|
|
// hideTitleBar: false,
|
|
|
|
|
// toolbarTopBackgroundColor: theme_colors.primaryColor,
|
|
|
|
|
// ),
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// browser.openUrlRequest(
|
|
|
|
|
// urlRequest: URLRequest(url: WebUri(url)),
|
|
|
|
|
// settings: settings,
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|