mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 21:24:20 +01:00
A little refreshing ui change :-)
This commit is contained in:
parent
7631cfd326
commit
5a8c072d64
9 changed files with 58 additions and 28 deletions
|
|
@ -13,3 +13,15 @@ A great starting point for learning Serverpod is our documentation site at:
|
||||||
To run the project, first make sure that the server is running, then do:
|
To run the project, first make sure that the server is running, then do:
|
||||||
|
|
||||||
flutter run
|
flutter run
|
||||||
|
|
||||||
|
## Flutter start:
|
||||||
|
|
||||||
|
add environment variable in the Additional arguments field in Android Studio:
|
||||||
|
|
||||||
|
--dart-define=SERVER_URL=http://localhost:5432/
|
||||||
|
|
||||||
|
Note: Host MUST end with a slash
|
||||||
|
|
||||||
|
## docker start:
|
||||||
|
|
||||||
|
wien_talks_server>docker compose -f docker-compose.local.yaml up -d
|
||||||
|
|
@ -10,6 +10,8 @@ class FunmapMgr {
|
||||||
|
|
||||||
late Client client;
|
late Client client;
|
||||||
|
|
||||||
|
late final serverUrl;
|
||||||
|
|
||||||
factory FunmapMgr() {
|
factory FunmapMgr() {
|
||||||
if (_instance != null) return _instance!;
|
if (_instance != null) return _instance!;
|
||||||
_instance = FunmapMgr._();
|
_instance = FunmapMgr._();
|
||||||
|
|
@ -24,11 +26,9 @@ class FunmapMgr {
|
||||||
// E.g. `flutter run --dart-define=SERVER_URL=https://api.example.com/`
|
// E.g. `flutter run --dart-define=SERVER_URL=https://api.example.com/`
|
||||||
|
|
||||||
const serverUrlFromEnv = String.fromEnvironment('SERVER_URL');
|
const serverUrlFromEnv = String.fromEnvironment('SERVER_URL');
|
||||||
final serverUrl =
|
serverUrl = serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
|
||||||
serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
|
|
||||||
|
|
||||||
client = Client(serverUrl, connectionTimeout: const Duration(seconds: 5))
|
client = Client(serverUrl, connectionTimeout: const Duration(seconds: 5))..connectivityMonitor = FlutterConnectivityMonitor();
|
||||||
..connectivityMonitor = FlutterConnectivityMonitor();
|
|
||||||
|
|
||||||
client.openStreamingConnection();
|
client.openStreamingConnection();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:wien_talks_flutter/helper/funmap_mgr.dart';
|
||||||
import 'package:wien_talks_flutter/show_latest_news_widget.dart';
|
import 'package:wien_talks_flutter/show_latest_news_widget.dart';
|
||||||
import 'package:wien_talks_flutter/widgets/intro_text_widget.dart';
|
import 'package:wien_talks_flutter/widgets/intro_text_widget.dart';
|
||||||
import 'package:wien_talks_flutter/widgets/screen_widget.dart';
|
import 'package:wien_talks_flutter/widgets/screen_widget.dart';
|
||||||
|
|
@ -19,7 +20,7 @@ class HomeScreen extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
IntroTextWidget(),
|
IntroTextWidget(),
|
||||||
ShowLatestNewsWidget(),
|
SizedBox(height: 200, child: ShowLatestNewsWidget()),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
|
|
@ -27,6 +28,9 @@ class HomeScreen extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStateProperty.all(Theme.of(context).primaryColor),
|
||||||
|
foregroundColor: WidgetStateProperty.all(Theme.of(context).colorScheme.onPrimary)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pushNamed("create_event");
|
context.pushNamed("create_event");
|
||||||
},
|
},
|
||||||
|
|
@ -38,6 +42,12 @@ class HomeScreen extends StatelessWidget {
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
CarouselWidget(),
|
CarouselWidget(),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Spacer(),
|
||||||
|
Text(FunmapMgr().serverUrl, style: Theme.of(context).textTheme.bodySmall),
|
||||||
|
],
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -26,29 +26,24 @@ class LocationMgr {
|
||||||
|
|
||||||
ViewModel? viewModel;
|
ViewModel? viewModel;
|
||||||
|
|
||||||
late MapModel mapModel;
|
MapModel? mapModel;
|
||||||
|
|
||||||
IconMarker? iconMarker;
|
IconMarker? iconMarker;
|
||||||
|
|
||||||
final DisplayModel displayModel = DisplayModel(maxZoomLevel: 20);
|
final DisplayModel displayModel = DisplayModel(maxZoomLevel: 18);
|
||||||
|
|
||||||
final SymbolCache symbolCache = FileSymbolCache();
|
final SymbolCache symbolCache = FileSymbolCache();
|
||||||
|
|
||||||
final JobRenderer jobRenderer = MapOnlineRenderer();
|
final JobRenderer jobRenderer = MapOnlineRenderer();
|
||||||
|
|
||||||
|
final MarkerByItemDataStore markerDataStore = MarkerByItemDataStore();
|
||||||
|
|
||||||
factory LocationMgr() {
|
factory LocationMgr() {
|
||||||
_instance ??= LocationMgr._();
|
_instance ??= LocationMgr._();
|
||||||
return _instance!;
|
return _instance!;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocationMgr._() {
|
LocationMgr._() {}
|
||||||
mapModel = MapModel(
|
|
||||||
displayModel: displayModel,
|
|
||||||
renderer: jobRenderer,
|
|
||||||
symbolCache: symbolCache,
|
|
||||||
tileBitmapCache: bitmapCache,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String?> startup() async {
|
Future<String?> startup() async {
|
||||||
serviceEnabled = await location.serviceEnabled();
|
serviceEnabled = await location.serviceEnabled();
|
||||||
|
|
@ -66,6 +61,13 @@ class LocationMgr {
|
||||||
return "No permissions granted";
|
return "No permissions granted";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mapModel = MapModel(
|
||||||
|
displayModel: displayModel,
|
||||||
|
renderer: jobRenderer,
|
||||||
|
symbolCache: symbolCache,
|
||||||
|
tileBitmapCache: bitmapCache,
|
||||||
|
);
|
||||||
|
mapModel?.markerDataStores.add(markerDataStore);
|
||||||
viewModel = ViewModel(displayModel: displayModel);
|
viewModel = ViewModel(displayModel: displayModel);
|
||||||
_subscription = location.onLocationChanged.listen((LocationData currentLocation) {
|
_subscription = location.onLocationChanged.listen((LocationData currentLocation) {
|
||||||
_lastLocationData = currentLocation;
|
_lastLocationData = currentLocation;
|
||||||
|
|
@ -78,7 +80,7 @@ class LocationMgr {
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
center: LatLong(currentLocation.latitude!, currentLocation.longitude!),
|
center: LatLong(currentLocation.latitude!, currentLocation.longitude!),
|
||||||
displayModel: displayModel);
|
displayModel: displayModel);
|
||||||
mapModel.markerDataStores.add(MarkerDataStore()..addMarker(iconMarker!));
|
mapModel?.markerDataStores.add(MarkerDataStore()..addMarker(iconMarker!));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_subject.add(currentLocation);
|
_subject.add(currentLocation);
|
||||||
|
|
@ -89,7 +91,8 @@ class LocationMgr {
|
||||||
void shutdown() {
|
void shutdown() {
|
||||||
_subscription?.cancel();
|
_subscription?.cancel();
|
||||||
_subscription = null;
|
_subscription = null;
|
||||||
mapModel.markerDataStores.clear();
|
mapModel?.dispose();
|
||||||
|
mapModel = null;
|
||||||
iconMarker = null;
|
iconMarker = null;
|
||||||
viewModel?.dispose();
|
viewModel?.dispose();
|
||||||
viewModel = null;
|
viewModel = null;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wien_talks_flutter/helper/funmap_mgr.dart';
|
|
||||||
import 'package:wien_talks_flutter/helper/go_router.dart';
|
import 'package:wien_talks_flutter/helper/go_router.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
FunmapMgr().configure();
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class _MapfileWidgetState extends State<MapfileWidget> {
|
||||||
return MapviewWidget(
|
return MapviewWidget(
|
||||||
displayModel: LocationMgr().displayModel,
|
displayModel: LocationMgr().displayModel,
|
||||||
createMapModel: () async {
|
createMapModel: () async {
|
||||||
return LocationMgr().mapModel;
|
return LocationMgr().mapModel!;
|
||||||
},
|
},
|
||||||
createViewModel: () async {
|
createViewModel: () async {
|
||||||
return LocationMgr().viewModel!;
|
return LocationMgr().viewModel!;
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,9 @@ class _NewsInputFormState extends State<NewsInputForm> {
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16.0),
|
const SizedBox(height: 16.0),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: WidgetStateProperty.all(Theme.of(context).primaryColor),
|
||||||
|
foregroundColor: WidgetStateProperty.all(Theme.of(context).colorScheme.onPrimary)),
|
||||||
onPressed: _submitForm,
|
onPressed: _submitForm,
|
||||||
child: const Text('Submit News'),
|
child: const Text('Submit News'),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,11 @@ import 'package:flutter/material.dart';
|
||||||
class ErrorSnackbar {
|
class ErrorSnackbar {
|
||||||
void show(BuildContext context, String message) {
|
void show(BuildContext context, String message) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||||
content: Text(message, style: TextStyle(color: Theme.of(context).colorScheme.onError)),
|
content: Text(
|
||||||
|
message,
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.onError),
|
||||||
|
maxLines: 3,
|
||||||
|
),
|
||||||
showCloseIcon: true,
|
showCloseIcon: true,
|
||||||
duration: Duration(seconds: 30),
|
duration: Duration(seconds: 30),
|
||||||
backgroundColor: Theme.of(context).colorScheme.error,
|
backgroundColor: Theme.of(context).colorScheme.error,
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ class IntroTextWidget extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Card(
|
||||||
padding: const EdgeInsets.all(8.0),
|
child: Padding(
|
||||||
child: Card(
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
|
@ -23,7 +23,7 @@ class IntroTextWidget extends StatelessWidget {
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
"Ever experienced something funny, weird, or just too good not to share? "
|
"Ever experienced something funny, weird, or just too good not to share? "
|
||||||
"With FunMap, you can pin your funniest moments and strange encounters right on the map! 🗺️😂",
|
"With FunMap, you can pin your funniest moments and strange encounters right on the map! 😂",
|
||||||
style: GoogleFonts.roboto(fontSize: 16, height: 1.5),
|
style: GoogleFonts.roboto(fontSize: 16, height: 1.5),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
@ -38,16 +38,16 @@ class IntroTextWidget extends StatelessWidget {
|
||||||
"👉 Add your event, mark the spot, and let the community enjoy the laughter with you.",
|
"👉 Add your event, mark the spot, and let the community enjoy the laughter with you.",
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
fontStyle: FontStyle.italic,
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
"Because the world’s a lot more fun when we laugh together. 🌍✨",
|
"Because the world’s a lot more fun when we laugh together.",
|
||||||
style: GoogleFonts.roboto(
|
style: GoogleFonts.roboto(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontStyle: FontStyle.italic,
|
fontWeight: FontWeight.w600,
|
||||||
height: 1.5,
|
height: 1.5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue