App wieder teilweise zurück gesetzt. Nur die Detailview angepasst. Datenbankabfrage im Detail_db view funktioniert aber momentan nur in Chrome.

This commit is contained in:
Niklas 2024-05-29 07:29:55 +02:00
parent d44bba99f0
commit 32af20768d
7 changed files with 103 additions and 120 deletions

View File

@ -22,7 +22,12 @@
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Accepts URIs that begin with YOUR_SCHEME://YOUR_HOST -->
<data
android:scheme="io.supabase.flutterquickstart"
android:host="login-callback" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@ -2,6 +2,8 @@ PODS:
- app_links (0.0.1):
- Flutter
- Flutter (1.0.0)
- image_picker_ios (0.0.1):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
@ -14,6 +16,7 @@ PODS:
DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- Flutter (from `Flutter`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
@ -23,6 +26,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/app_links/ios"
Flutter:
:path: Flutter
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
shared_preferences_foundation:
@ -33,6 +38,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
app_links: e70ca16b4b0f88253b3b3660200d4a10b4ea9795
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586

View File

@ -45,5 +45,16 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>io.supabase.flutterquickstart</string>
</array>
</dict>
</array>
</dict>
</plist>

View File

@ -10,8 +10,11 @@ import 'utils/constants.dart';
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: 'http://192.168.179.86:8000/',//'https://vvtefqdqahcpzgolvupv.supabase.co',//'https://vvtefqdqahcpzgolvupv.supabase.co',//
anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZ2dGVmcWRxYWhjcHpnb2x2dXB2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTYwMjE2NTIsImV4cCI6MjAzMTU5NzY1Mn0.1bp5V61Oguo5zLUhCFJmCabUY1sujeISr_CR2XUKvh4',//'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZ2dGVmcWRxYWhjcHpnb2x2dXB2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTYwMjE3ODksImV4cCI6MjAzMTU5Nzc4OX0.6g5EtS9HrgxC6cpCYgOT0HLpA4lEnASQbKs9mfnUM7k',//Constants.supabaseAnnonKey,//
url: 'https://vvtefqdqahcpzgolvupv.supabase.co',
anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZ2dGVmcWRxYWhjcHpnb2x2dXB2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTYwMjE3ODksImV4cCI6MjAzMTU5Nzc4OX0.6g5EtS9HrgxC6cpCYgOT0HLpA4lEnASQbKs9mfnUM7k',
//Locale
//url:'http://192.168.179.86:8000/',//
// annonKey: //Constants.supabaseAnnonKey,//'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZ2dGVmcWRxYWhjcHpnb2x2dXB2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTYwMjE2NTIsImV4cCI6MjAzMTU5NzY1Mn0.1bp5V61Oguo5zLUhCFJmCabUY1sujeISr_CR2XUKvh4',//
);
runApp( MyApp());
}
@ -20,10 +23,27 @@ import 'utils/constants.dart';
final supabase = Supabase.instance.client;
/// Error message to display the user when unexpected error occurs.
const unexpectedErrorMessage = 'Unexpected error occurred.';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
//title: 'Recipes',
theme: ThemeData(
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: const Color(0xff263341),
secondary: const Color(0xff8DB646), // Your accent color
),
),
home: HomePage(),
);
}
}
/* class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
@ -71,90 +91,9 @@ class _HomePageState extends State<HomePage> {
}
}
/* class MyApp extends StatelessWidget { */
//MyApp({super.key});
/* @override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
//title: 'Recipes',
theme: ThemeData(
colorScheme: ColorScheme.fromSwatch().copyWith(
primary: Colors.white,
secondary: const Color(0xff8DB646), // Your accent color
),
),
home: const HomePage(),
);
} */
/* @override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Supabase Flutter',
theme: ThemeData.dark().copyWith(
primaryColor: Colors.green,
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: Colors.green,
),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: Colors.green,
),
),
),
initialRoute: '/',
routes: <String, WidgetBuilder>{
'/': (_) => const SplashPage(),
'/login': (_) => const LoginPage(),
'/account': (_) => const AccountPage(),
},
);
} */
/* Future<void> readData() async {
final response = await Supabase.instance.client.from('events').select();
if (response.error == null) {
final data = response.data;
print('Fetched data: $data');
} else {
print('Error reading data: ${response.error!.message}');
}}
final _future = Supabase.instance.client
.from('events')
.select();
@override
Widget build(BuildContext context) {
return Directionality(
textDirection: TextDirection.ltr,
child: Scaffold(
appBar: AppBar(
title: Text('Home Page'),
),
body: FutureBuilder(
future: _future,
builder: (context, snapshot) {
}
final countries = snapshot.data!;
return ListView.builder(
itemCount: countries.length,
itemBuilder: ((context, index) {
final country = countries[index];
return ListTile(
title: Text(country['name']),
);
}),
);})));
}
}
class _execute {
}*/
*/

View File

@ -4,35 +4,11 @@ import 'package:learn_project/utils/widgets.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
class DetailsPage extends StatelessWidget {
//final Recipe recipe;
final _future = Supabase.instance.client
.from('events')
.select();
//const DetailsPage({required this.recipe});
@override
Widget build(BuildContext context) {
return Scaffold(
body: FutureBuilder(
future: _future,
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const Center(child: CircularProgressIndicator());
}
final events = snapshot.data!;
return ListView.builder(
itemCount: events.length,
itemBuilder: ((context, index) {
final event = events[index];
return ListTile(
title: Text(event['name']),
);
}),
);
},
),
);
}
/* @override
final Recipe recipe;
const DetailsPage({required this.recipe});
@override
Widget build(BuildContext context) {
return Scaffold(
body: NestedScrollView(
@ -95,7 +71,7 @@ class DetailsPage extends StatelessWidget {
),
),
);
} */
}
}
class RecipeSteps extends StatelessWidget {
@ -183,3 +159,6 @@ class NutritionWidget extends StatelessWidget {
);
}
}
final _future = Supabase.instance.client
.from('events')
.select();

View File

@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:learn_project/utils/class.dart';
import 'package:learn_project/utils/widgets.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import 'dart:async';
class DetailsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final _future2 = Supabase.instance.client
.from('events')
.select();
return Scaffold(
body: FutureBuilder(
future: _future2,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else if (!snapshot.hasData) {
return const Center(child: Text('No data found'));
}
final events = snapshot.data!;
return ListView.builder(
itemCount: events.length,
itemBuilder: ((context, index) {
final event = events[index];
return ListTile(
title: Text(event['name']),
subtitle: Text(event['description']),
);
}),
);
},
),
);
}
}

View File

@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:learn_project/screens/details.dart';
import 'package:learn_project/screens/details_db.dart';
import 'package:learn_project/utils/data.dart';
class HomePage extends StatelessWidget {
@ -144,7 +144,7 @@ class HomePage extends StatelessWidget {
context,
MaterialPageRoute(
builder: (context) => DetailsPage(
//_future: Data.recipes[index],
//recipe: Data.recipes[index],
)));
},
child: Card(