"Steal" theme from example app

This commit is contained in:
2024-05-12 13:53:29 +03:00
parent 78e468cc29
commit 2c2221f7f1

View File

@@ -1,7 +1,7 @@
import 'dart:math';
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/providers/main.dart';
import 'package:provider/provider.dart';
@@ -23,6 +23,7 @@ class MyExampleApp extends StatelessWidget {
builder: (context, provider, __) => const ExamplePage(),
),
),
theme: ThemeData.dark(),
);
}
}
@@ -38,38 +39,40 @@ class _ExamplePageState extends State<ExamplePage> {
@override
void initState() {
super.initState();
context.read<GymLinkProvider>().onTokenReceived('token123');
Future.microtask(
() => context.read<GymLinkProvider>().onTokenReceived('token123'));
}
@override
Widget build(BuildContext context) {
return Consumer<GymLinkProvider>(
builder: (context, provider, __) => Scaffold(
appBar: AppBar(title: const Text('GymLink Example App')),
body: Column(
children: [
const Text('test'),
IconButton(
icon: const Icon(Icons.abc),
onPressed: () {
provider.onTokenReceived('token123');
},
),
const Expanded(
child: MyApp(),
),
const SizedBox(
height: 20,
),
const Text('Bottom text')
],
),
floatingActionButton: IconButton(
icon: const Icon(Icons.search),
onPressed: () {
provider.changeTheme(Random().nextInt(0xffffff + 1));
},
),
return Scaffold(
appBar: AppBar(title: const Text('GymLink Example App')),
body: Column(
children: [
const Text('test'),
IconButton(
icon: const Icon(Icons.abc),
onPressed: () {
context.read<GymLinkProvider>().onTokenReceived('token123');
},
),
Expanded(
child:
MainPage(isLoading: context.watch<GymLinkProvider>().isLoading),
),
const SizedBox(
height: 20,
),
const Text('Bottom text')
],
),
floatingActionButton: IconButton(
icon: const Icon(Icons.search),
onPressed: () {
context
.read<GymLinkProvider>()
.changeTheme(Random().nextInt(0xffffff + 1));
},
),
);
}