Mobile example app

This commit is contained in:
2024-05-12 13:42:05 +03:00
parent 75bfc7ea6b
commit 6c4c2c4acd
4 changed files with 109 additions and 25 deletions

View File

@@ -1,35 +1,19 @@
import 'package:flutter/material.dart';
import 'package:gymlink_module_web/main_mobile.dart';
import 'package:gymlink_module_web/pages/main.dart';
import 'package:gymlink_module_web/theme.dart';
import 'package:gymlink_module_web/providers/main.dart';
import 'package:provider/provider.dart';
class MyAppStateMobile extends State<MyApp> {
bool _isLoading = false;
ThemeData theme = myTheme;
bool black_theme = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'GymLink Module',
theme: theme,
debugShowCheckedModeBanner: false,
home: MainPage(isLoading: _isLoading),
return Consumer<ModuleMethods>(
builder: (context, provider, __) => MaterialApp(
title: 'GymLink Module',
theme: provider.theme,
debugShowCheckedModeBanner: false,
home: MainPage(isLoading: provider.isLoading),
),
);
}
void onTokenReceived(String token) {
if (token == 'token123') {
setState(() {
_isLoading = false;
});
}
}
void changeColor(int color) {
setState(() {
black_theme = !black_theme; //FIXME: TEMPORARY
theme = getThemeData(Color(color), black_theme);
});
}
}