mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 17:14:21 +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:
|
||||
|
||||
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 final serverUrl;
|
||||
|
||||
factory FunmapMgr() {
|
||||
if (_instance != null) return _instance!;
|
||||
_instance = FunmapMgr._();
|
||||
|
|
@ -24,11 +26,9 @@ class FunmapMgr {
|
|||
// 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;
|
||||
serverUrl = serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
|
||||
|
||||
client = Client(serverUrl, connectionTimeout: const Duration(seconds: 5))
|
||||
..connectivityMonitor = FlutterConnectivityMonitor();
|
||||
client = Client(serverUrl, connectionTimeout: const Duration(seconds: 5))..connectivityMonitor = FlutterConnectivityMonitor();
|
||||
|
||||
client.openStreamingConnection();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.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/widgets/intro_text_widget.dart';
|
||||
import 'package:wien_talks_flutter/widgets/screen_widget.dart';
|
||||
|
|
@ -19,7 +20,7 @@ class HomeScreen extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
IntroTextWidget(),
|
||||
ShowLatestNewsWidget(),
|
||||
SizedBox(height: 200, child: ShowLatestNewsWidget()),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
|
|
@ -27,6 +28,9 @@ class HomeScreen extends StatelessWidget {
|
|||
children: [
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(Theme.of(context).primaryColor),
|
||||
foregroundColor: WidgetStateProperty.all(Theme.of(context).colorScheme.onPrimary)),
|
||||
onPressed: () {
|
||||
context.pushNamed("create_event");
|
||||
},
|
||||
|
|
@ -38,6 +42,12 @@ class HomeScreen extends StatelessWidget {
|
|||
height: 30,
|
||||
),
|
||||
CarouselWidget(),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
Text(FunmapMgr().serverUrl, style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -26,29 +26,24 @@ class LocationMgr {
|
|||
|
||||
ViewModel? viewModel;
|
||||
|
||||
late MapModel mapModel;
|
||||
MapModel? mapModel;
|
||||
|
||||
IconMarker? iconMarker;
|
||||
|
||||
final DisplayModel displayModel = DisplayModel(maxZoomLevel: 20);
|
||||
final DisplayModel displayModel = DisplayModel(maxZoomLevel: 18);
|
||||
|
||||
final SymbolCache symbolCache = FileSymbolCache();
|
||||
|
||||
final JobRenderer jobRenderer = MapOnlineRenderer();
|
||||
|
||||
final MarkerByItemDataStore markerDataStore = MarkerByItemDataStore();
|
||||
|
||||
factory LocationMgr() {
|
||||
_instance ??= LocationMgr._();
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
LocationMgr._() {
|
||||
mapModel = MapModel(
|
||||
displayModel: displayModel,
|
||||
renderer: jobRenderer,
|
||||
symbolCache: symbolCache,
|
||||
tileBitmapCache: bitmapCache,
|
||||
);
|
||||
}
|
||||
LocationMgr._() {}
|
||||
|
||||
Future<String?> startup() async {
|
||||
serviceEnabled = await location.serviceEnabled();
|
||||
|
|
@ -66,6 +61,13 @@ class LocationMgr {
|
|||
return "No permissions granted";
|
||||
}
|
||||
}
|
||||
mapModel = MapModel(
|
||||
displayModel: displayModel,
|
||||
renderer: jobRenderer,
|
||||
symbolCache: symbolCache,
|
||||
tileBitmapCache: bitmapCache,
|
||||
);
|
||||
mapModel?.markerDataStores.add(markerDataStore);
|
||||
viewModel = ViewModel(displayModel: displayModel);
|
||||
_subscription = location.onLocationChanged.listen((LocationData currentLocation) {
|
||||
_lastLocationData = currentLocation;
|
||||
|
|
@ -78,7 +80,7 @@ class LocationMgr {
|
|||
color: Colors.red,
|
||||
center: LatLong(currentLocation.latitude!, currentLocation.longitude!),
|
||||
displayModel: displayModel);
|
||||
mapModel.markerDataStores.add(MarkerDataStore()..addMarker(iconMarker!));
|
||||
mapModel?.markerDataStores.add(MarkerDataStore()..addMarker(iconMarker!));
|
||||
}
|
||||
}
|
||||
_subject.add(currentLocation);
|
||||
|
|
@ -89,7 +91,8 @@ class LocationMgr {
|
|||
void shutdown() {
|
||||
_subscription?.cancel();
|
||||
_subscription = null;
|
||||
mapModel.markerDataStores.clear();
|
||||
mapModel?.dispose();
|
||||
mapModel = null;
|
||||
iconMarker = null;
|
||||
viewModel?.dispose();
|
||||
viewModel = null;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:wien_talks_flutter/helper/funmap_mgr.dart';
|
||||
import 'package:wien_talks_flutter/helper/go_router.dart';
|
||||
|
||||
void main() {
|
||||
FunmapMgr().configure();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class _MapfileWidgetState extends State<MapfileWidget> {
|
|||
return MapviewWidget(
|
||||
displayModel: LocationMgr().displayModel,
|
||||
createMapModel: () async {
|
||||
return LocationMgr().mapModel;
|
||||
return LocationMgr().mapModel!;
|
||||
},
|
||||
createViewModel: () async {
|
||||
return LocationMgr().viewModel!;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ class _NewsInputFormState extends State<NewsInputForm> {
|
|||
),
|
||||
const SizedBox(height: 16.0),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(Theme.of(context).primaryColor),
|
||||
foregroundColor: WidgetStateProperty.all(Theme.of(context).colorScheme.onPrimary)),
|
||||
onPressed: _submitForm,
|
||||
child: const Text('Submit News'),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ import 'package:flutter/material.dart';
|
|||
class ErrorSnackbar {
|
||||
void show(BuildContext context, String message) {
|
||||
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,
|
||||
duration: Duration(seconds: 30),
|
||||
backgroundColor: Theme.of(context).colorScheme.error,
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ class IntroTextWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Card(
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
@ -23,7 +23,7 @@ class IntroTextWidget extends StatelessWidget {
|
|||
const SizedBox(height: 20),
|
||||
Text(
|
||||
"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),
|
||||
),
|
||||
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.",
|
||||
style: GoogleFonts.roboto(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontStyle: FontStyle.italic,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
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(
|
||||
fontSize: 16,
|
||||
fontStyle: FontStyle.italic,
|
||||
fontWeight: FontWeight.w600,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue