diff --git a/wien_talks/wien_talks_client/.idea/.gitignore b/wien_talks/wien_talks_client/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/wien_talks/wien_talks_client/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/wien_talks/wien_talks_client/.idea/caches/deviceStreaming.xml b/wien_talks/wien_talks_client/.idea/caches/deviceStreaming.xml
new file mode 100644
index 0000000..9aaec77
--- /dev/null
+++ b/wien_talks/wien_talks_client/.idea/caches/deviceStreaming.xml
@@ -0,0 +1,835 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wien_talks/wien_talks_client/.idea/misc.xml b/wien_talks/wien_talks_client/.idea/misc.xml
new file mode 100644
index 0000000..1945ce5
--- /dev/null
+++ b/wien_talks/wien_talks_client/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wien_talks/wien_talks_client/.idea/modules.xml b/wien_talks/wien_talks_client/.idea/modules.xml
new file mode 100644
index 0000000..317fd21
--- /dev/null
+++ b/wien_talks/wien_talks_client/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wien_talks/wien_talks_client/.idea/vcs.xml b/wien_talks/wien_talks_client/.idea/vcs.xml
new file mode 100644
index 0000000..b2bdec2
--- /dev/null
+++ b/wien_talks/wien_talks_client/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wien_talks/wien_talks_client/.idea/wien_talks_client.iml b/wien_talks/wien_talks_client/.idea/wien_talks_client.iml
new file mode 100644
index 0000000..0cf94bd
--- /dev/null
+++ b/wien_talks/wien_talks_client/.idea/wien_talks_client.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/wien_talks/wien_talks_client/pubspec.yaml b/wien_talks/wien_talks_client/pubspec.yaml
index 223e12d..2e6dc95 100644
--- a/wien_talks/wien_talks_client/pubspec.yaml
+++ b/wien_talks/wien_talks_client/pubspec.yaml
@@ -5,4 +5,6 @@ environment:
sdk: '>=3.5.0 <4.0.0'
dependencies:
+
serverpod_client: 2.9.1
+
diff --git a/wien_talks/wien_talks_flutter/android/app/src/main/AndroidManifest.xml b/wien_talks/wien_talks_flutter/android/app/src/main/AndroidManifest.xml
index 8d61822..fd81ced 100644
--- a/wien_talks/wien_talks_flutter/android/app/src/main/AndroidManifest.xml
+++ b/wien_talks/wien_talks_flutter/android/app/src/main/AndroidManifest.xml
@@ -42,4 +42,7 @@
+
+
+
diff --git a/wien_talks/wien_talks_flutter/lib/create_event_screen.dart b/wien_talks/wien_talks_flutter/lib/create_event_screen.dart
new file mode 100644
index 0000000..00c755a
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/create_event_screen.dart
@@ -0,0 +1,18 @@
+import 'package:flutter/cupertino.dart';
+import 'package:wien_talks_flutter/get_location_widget.dart';
+import 'package:wien_talks_flutter/widgets/screen_widget.dart';
+
+class CreateEventScreen extends StatelessWidget {
+ const CreateEventScreen({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return ScreenWidget(
+ child: Column(
+ children: [
+ Text("hello"),
+ GetLocationWidget(),
+ ],
+ ));
+ }
+}
diff --git a/wien_talks/wien_talks_flutter/lib/get_location_widget.dart b/wien_talks/wien_talks_flutter/lib/get_location_widget.dart
new file mode 100644
index 0000000..f0c0d0d
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/get_location_widget.dart
@@ -0,0 +1,32 @@
+import 'package:flutter/material.dart';
+import 'package:wien_talks_flutter/location_mgr.dart';
+
+class GetLocationWidget extends StatelessWidget {
+ const GetLocationWidget({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ return FutureBuilder(
+ future: LocationMgr().startup(),
+ builder: (BuildContext context, AsyncSnapshot snapshot) {
+ switch (snapshot.connectionState) {
+ case ConnectionState.waiting:
+ return CircularProgressIndicator();
+ case ConnectionState.done:
+ {
+ if (snapshot.hasData) {
+ // Error occured
+ return Text(snapshot.data.toString());
+ } else {
+ return Text("No data -> OK");
+ }
+ }
+ default:
+ if (snapshot.hasError) {
+ return Text('Error: ${snapshot.error}');
+ }
+ return Text("OK");
+ }
+ });
+ }
+}
diff --git a/wien_talks/wien_talks_flutter/lib/go_router.dart b/wien_talks/wien_talks_flutter/lib/go_router.dart
new file mode 100644
index 0000000..40fb9e9
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/go_router.dart
@@ -0,0 +1,13 @@
+import 'package:go_router/go_router.dart';
+import 'package:wien_talks_flutter/create_event_screen.dart';
+import 'package:wien_talks_flutter/news_screen.dart';
+
+final router = GoRouter(
+ routes: [
+ GoRoute(
+ path: '/',
+ builder: (context, state) => NewsScreen(),
+ ),
+ GoRoute(path: '/create_event', name: 'create_event', builder: (context, state) => CreateEventScreen()),
+ ],
+);
diff --git a/wien_talks/wien_talks_flutter/lib/location_mgr.dart b/wien_talks/wien_talks_flutter/lib/location_mgr.dart
new file mode 100644
index 0000000..c2f7509
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/location_mgr.dart
@@ -0,0 +1,39 @@
+import 'package:location/location.dart';
+
+class LocationMgr {
+ Location location = Location();
+
+ bool serviceEnabled = false;
+
+ PermissionStatus permissionGranted = PermissionStatus.denied;
+
+ LocationData? locationData;
+
+ static LocationMgr? _instance;
+
+ factory LocationMgr() {
+ _instance ??= LocationMgr._();
+ return _instance!;
+ }
+
+ LocationMgr._();
+
+ Future startup() async {
+ serviceEnabled = await location.serviceEnabled();
+ if (!serviceEnabled) {
+ serviceEnabled = await location.requestService();
+ if (!serviceEnabled) {
+ return "Service is not enabled";
+ }
+ }
+
+ permissionGranted = await location.hasPermission();
+ if (permissionGranted == PermissionStatus.denied) {
+ permissionGranted = await location.requestPermission();
+ if (permissionGranted != PermissionStatus.granted) {
+ return "No permissions granted";
+ }
+ }
+ return null;
+ }
+}
diff --git a/wien_talks/wien_talks_flutter/lib/main.dart b/wien_talks/wien_talks_flutter/lib/main.dart
index 69c728d..b1326db 100644
--- a/wien_talks/wien_talks_flutter/lib/main.dart
+++ b/wien_talks/wien_talks_flutter/lib/main.dart
@@ -1,6 +1,7 @@
-import 'package:wien_talks_client/wien_talks_client.dart';
import 'package:flutter/material.dart';
import 'package:serverpod_flutter/serverpod_flutter.dart';
+import 'package:wien_talks_client/wien_talks_client.dart';
+import 'package:wien_talks_flutter/go_router.dart';
/// Sets up a global client object that can be used to talk to the server from
/// anywhere in our app. The client is generated from your server code
@@ -20,11 +21,9 @@ void main() {
// You can set the variable when running or building your app like this:
// E.g. `flutter run --dart-define=SERVER_URL=https://api.example.com/`
const serverUrlFromEnv = String.fromEnvironment('SERVER_URL');
- final serverUrl =
- serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
+ final serverUrl = serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
- client = Client(serverUrl)
- ..connectivityMonitor = FlutterConnectivityMonitor();
+ client = Client(serverUrl)..connectivityMonitor = FlutterConnectivityMonitor();
runApp(const MyApp());
}
@@ -34,10 +33,12 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return MaterialApp(
+ return MaterialApp.router(
title: 'Serverpod Demo',
theme: ThemeData(primarySwatch: Colors.blue),
- home: const MyHomePage(title: 'Serverpod Example'),
+ routerConfig: router,
+ //home: NewsScreen(),
+ //home: const MyHomePage(title: 'Serverpod Example'),
);
}
}
diff --git a/wien_talks/wien_talks_flutter/lib/news_screen.dart b/wien_talks/wien_talks_flutter/lib/news_screen.dart
new file mode 100644
index 0000000..5cdd782
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/news_screen.dart
@@ -0,0 +1,33 @@
+import 'package:flutter/material.dart';
+import 'package:go_router/go_router.dart';
+import 'package:wien_talks_flutter/widgets/heading_text.dart';
+import 'package:wien_talks_flutter/widgets/screen_widget.dart';
+
+class NewsScreen extends StatelessWidget {
+ const NewsScreen({
+ super.key,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ return ScreenWidget(
+ child: SingleChildScrollView(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ HeadingText(text: "Latest news"),
+ ...[Text("News 1"), Text("News 2")],
+ SizedBox(
+ height: 30,
+ ),
+ OutlinedButton(
+ onPressed: () {
+ context.pushNamed("create_event");
+ },
+ child: Text("Submit your own event")),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/wien_talks/wien_talks_flutter/lib/widgets/heading_text.dart b/wien_talks/wien_talks_flutter/lib/widgets/heading_text.dart
new file mode 100644
index 0000000..9aeb9f8
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/widgets/heading_text.dart
@@ -0,0 +1,18 @@
+import 'package:flutter/material.dart';
+
+class HeadingText extends StatelessWidget {
+ final String text;
+
+ const HeadingText({super.key, required this.text});
+
+ @override
+ Widget build(BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.only(top: 20, bottom: 10),
+ child: Text(
+ text,
+ style: Theme.of(context).textTheme.headlineLarge,
+ ),
+ );
+ }
+}
diff --git a/wien_talks/wien_talks_flutter/lib/widgets/screen_widget.dart b/wien_talks/wien_talks_flutter/lib/widgets/screen_widget.dart
new file mode 100644
index 0000000..26638d4
--- /dev/null
+++ b/wien_talks/wien_talks_flutter/lib/widgets/screen_widget.dart
@@ -0,0 +1,21 @@
+import 'package:flutter/material.dart';
+
+class ScreenWidget extends StatelessWidget {
+ final Widget child;
+
+ const ScreenWidget({super.key, required this.child});
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text('News'),
+ ),
+ body: SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: child,
+ )),
+ );
+ }
+}
diff --git a/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift b/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift
index ad535f5..67b21c7 100644
--- a/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/wien_talks/wien_talks_flutter/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -6,7 +6,9 @@ import FlutterMacOS
import Foundation
import connectivity_plus
+import location
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
+ LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
}
diff --git a/wien_talks/wien_talks_flutter/pubspec.lock b/wien_talks/wien_talks_flutter/pubspec.lock
index f06f119..0558773 100644
--- a/wien_talks/wien_talks_flutter/pubspec.lock
+++ b/wien_talks/wien_talks_flutter/pubspec.lock
@@ -136,6 +136,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ go_router:
+ dependency: "direct main"
+ description:
+ name: go_router
+ sha256: "8b1f37dfaf6e958c6b872322db06f946509433bec3de753c3491a42ae9ec2b48"
+ url: "https://pub.dev"
+ source: hosted
+ version: "16.1.0"
http:
dependency: transitive
description:
@@ -184,6 +192,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.0"
+ location:
+ dependency: "direct main"
+ description:
+ name: location
+ sha256: b080053c181c7d152c43dd576eec6436c40e25f326933051c330da563ddd5333
+ url: "https://pub.dev"
+ source: hosted
+ version: "8.0.1"
+ location_platform_interface:
+ dependency: transitive
+ description:
+ name: location_platform_interface
+ sha256: ca8700bb3f6b1e8b2afbd86bd78b2280d116c613ca7bfa1d4d7b64eba357d749
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.0.1"
+ location_web:
+ dependency: transitive
+ description:
+ name: location_web
+ sha256: b8e3add5efe0d65c5e692b7a135d80a4015c580d3ea646fa71973e97668dd868
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.0.1"
+ logging:
+ dependency: transitive
+ description:
+ name: logging
+ sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.3.0"
matcher:
dependency: transitive
description:
@@ -406,4 +446,4 @@ packages:
version: "3.1.3"
sdks:
dart: ">=3.8.0 <4.0.0"
- flutter: ">=3.24.0"
+ flutter: ">=3.27.0"
diff --git a/wien_talks/wien_talks_flutter/pubspec.yaml b/wien_talks/wien_talks_flutter/pubspec.yaml
index 3f0110a..5490c5a 100644
--- a/wien_talks/wien_talks_flutter/pubspec.yaml
+++ b/wien_talks/wien_talks_flutter/pubspec.yaml
@@ -24,11 +24,16 @@ environment:
dependencies:
flutter:
sdk: flutter
+
+ go_router: ^16.1.0
+
+ location: ^8.0.1
+
serverpod_flutter: 2.9.1
+
wien_talks_client:
path: ../wien_talks_client
-
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.5