Mobile adaptive updates
This commit is contained in:
@@ -24,7 +24,7 @@ if (flutterVersionName == null) {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace "com.example.flutter_application_1"
|
namespace "com.example.flutter_application_1"
|
||||||
compileSdk 34
|
compileSdk flutter.compileSdkVersion
|
||||||
ndkVersion flutter.ndkVersion
|
ndkVersion flutter.ndkVersion
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:gymlink_module_web/pages/main.dart';
|
import 'package:gymlink_module_web/main_mobile.dart';
|
||||||
import 'package:gymlink_module_web/providers/main.dart';
|
import 'package:gymlink_module_web/providers/main.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
@@ -73,6 +73,9 @@ class _ExamplePageState extends State<ExamplePage> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
Future.microtask(
|
Future.microtask(
|
||||||
() => context.read<GymLinkProvider>().onTokenReceived('token123'));
|
() => context.read<GymLinkProvider>().onTokenReceived('token123'));
|
||||||
|
Future.microtask(() => context
|
||||||
|
.read<GymLinkProvider>()
|
||||||
|
.setTheme(ThemeData.dark(useMaterial3: true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -91,9 +94,8 @@ class _ExamplePageState extends State<ExamplePage> {
|
|||||||
context.read<GymLinkProvider>().onTokenReceived('token123');
|
context.read<GymLinkProvider>().onTokenReceived('token123');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Expanded(
|
const Expanded(
|
||||||
child:
|
child: MyApp(),
|
||||||
MainPage(isLoading: context.watch<GymLinkProvider>().isLoading),
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
|
|||||||
@@ -180,6 +180,21 @@ class _BasketPageState extends State<BasketPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildRowOrCol(
|
||||||
|
{required BuildContext context, required List<Widget> children}) {
|
||||||
|
if (MediaQuery.of(context).size.width > 600) {
|
||||||
|
return Row(children: children);
|
||||||
|
}
|
||||||
|
return Column(children: children);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSpacer() {
|
||||||
|
if (MediaQuery.of(context).size.width > 600) {
|
||||||
|
return const Spacer();
|
||||||
|
}
|
||||||
|
return const SizedBox(height: 10);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -213,7 +228,8 @@ class _BasketPageState extends State<BasketPage> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Expanded(
|
: Expanded(
|
||||||
child: Row(
|
child: _buildRowOrCol(
|
||||||
|
context: context,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
@@ -236,7 +252,7 @@ class _BasketPageState extends State<BasketPage> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
_buildSpacer(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.symmetric(
|
padding: const EdgeInsetsDirectional.symmetric(
|
||||||
horizontal: 10, vertical: 10),
|
horizontal: 10, vertical: 10),
|
||||||
|
|||||||
@@ -41,6 +41,23 @@ class _DetailPageState extends State<DetailPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildRowOrCol(
|
||||||
|
{required List<Widget> children,
|
||||||
|
required BuildContext context,
|
||||||
|
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.spaceAround,
|
||||||
|
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center}) {
|
||||||
|
// if (false && MediaQuery.of(context).size.width > 600) {
|
||||||
|
// return Row(
|
||||||
|
// mainAxisAlignment: mainAxisAlignment,
|
||||||
|
// crossAxisAlignment: crossAxisAlignment,
|
||||||
|
// children: children);
|
||||||
|
// }
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: mainAxisAlignment,
|
||||||
|
crossAxisAlignment: crossAxisAlignment,
|
||||||
|
children: children);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildButton() {
|
Widget _buildButton() {
|
||||||
if (!isInCart) {
|
if (!isInCart) {
|
||||||
return ElevatedButton(
|
return ElevatedButton(
|
||||||
@@ -100,22 +117,22 @@ class _DetailPageState extends State<DetailPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: const GymLinkAppBar(),
|
appBar: const GymLinkAppBar(),
|
||||||
body: Column(mainAxisAlignment: MainAxisAlignment.start, children: [
|
body: Column(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||||
GymLinkHeader(title: '${widget.name} - ${widget.id}'),
|
GymLinkHeader(title: widget.name),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
// height: MediaQuery.sizeOf(context).height,
|
||||||
child: Row(
|
child: _buildRowOrCol(
|
||||||
|
context: context,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
widget.image,
|
widget.image,
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding: const EdgeInsetsDirectional.all(30),
|
||||||
const EdgeInsetsDirectional.fromSTEB(0, 30, 60, 60),
|
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minWidth: 340,
|
minWidth: 340,
|
||||||
@@ -130,8 +147,7 @@ class _DetailPageState extends State<DetailPage> {
|
|||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(
|
padding: const EdgeInsetsDirectional.all(15),
|
||||||
20, 15, 10, 15),
|
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
minHeight: 100,
|
minHeight: 100,
|
||||||
@@ -150,7 +166,7 @@ class _DetailPageState extends State<DetailPage> {
|
|||||||
alignment: const AlignmentDirectional(0, -1),
|
alignment: const AlignmentDirectional(0, -1),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsetsDirectional.fromSTEB(0, 60, 0, 0),
|
const EdgeInsetsDirectional.fromSTEB(0, 30, 0, 0),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -20,4 +20,9 @@ class GymLinkProvider with ChangeNotifier {
|
|||||||
_theme = getThemeData(Color(color), _blackTheme);
|
_theme = getThemeData(Color(color), _blackTheme);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setTheme(ThemeData theme) {
|
||||||
|
_theme = theme;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
16
pubspec.lock
16
pubspec.lock
@@ -216,6 +216,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.11.0"
|
version: "1.11.0"
|
||||||
|
nested:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: nested
|
||||||
|
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -264,6 +272,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
|
provider:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: provider
|
||||||
|
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.2"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user