fixed view on mobile or other devices
This commit is contained in:
@@ -5,10 +5,19 @@ import 'package:mensaappbackend/providers/viewProvider.dart';
|
||||
import 'package:mensaappbackend/providers/timeProvider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
import 'dart:html' as html;
|
||||
|
||||
class PageDashboard extends StatelessWidget {
|
||||
const PageDashboard({super.key});
|
||||
|
||||
bool isMobileBrowser() {
|
||||
String userAgent = html.window.navigator.userAgent;
|
||||
return userAgent.contains('Mobile') ||
|
||||
userAgent.contains('Android') ||
|
||||
userAgent.contains('iPhone') ||
|
||||
userAgent.contains('iPad');
|
||||
}
|
||||
|
||||
Future<List<dynamic>> requestSupabaseTimeSpan(int timeId) async {
|
||||
var supabase = Supabase.instance.client;
|
||||
var now = DateTime.now();
|
||||
@@ -32,6 +41,11 @@ class PageDashboard extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
bool browser_mobile = isMobileBrowser();
|
||||
|
||||
String dashboard_text = browser_mobile ? "" : "Dashboard";
|
||||
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
@@ -40,10 +54,10 @@ class PageDashboard extends StatelessWidget {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
"Dashboard",
|
||||
dashboard_text,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),
|
||||
),
|
||||
SizedBox(width: 32),
|
||||
SizedBox(width: browser_mobile ? 0 : 32),
|
||||
Icon(Icons.watch_later, ),
|
||||
SizedBox(width: 8),
|
||||
SizedBox(
|
||||
|
||||
Reference in New Issue
Block a user