carousel implemented
BIN
wien_talks/wien_talks_flutter/assets/funny_images/falco.jpg
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
wien_talks/wien_talks_flutter/assets/funny_images/fiaker.jpg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
wien_talks/wien_talks_flutter/assets/funny_images/houses.jpg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
wien_talks/wien_talks_flutter/assets/funny_images/kangaroos.jpg
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
BIN
wien_talks/wien_talks_flutter/assets/funny_images/tram.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
wien_talks/wien_talks_flutter/assets/funny_images/wastebin.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
26
wien_talks/wien_talks_flutter/lib/carousel_widget.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CarouselWidget extends StatelessWidget {
|
||||||
|
const CarouselWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return IgnorePointer(
|
||||||
|
child: CarouselSlider(
|
||||||
|
options: CarouselOptions(height: 300.0, autoPlay: true),
|
||||||
|
items: ["houses.jpg", "kangaroos.jpg", "sightseeing.jpg", "tram.jpg", "fiaker.jpg", "falco.jpg", "wastebin.jpg"].map((i) {
|
||||||
|
return Builder(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
|
//decoration: BoxDecoration(color: Colors.amber),
|
||||||
|
child: Image(image: AssetImage("assets/funny_images/$i")));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:location/location.dart';
|
import 'package:location/location.dart';
|
||||||
|
import 'package:wien_talks_client/wien_talks_client.dart';
|
||||||
import 'package:wien_talks_flutter/get_location_widget.dart';
|
import 'package:wien_talks_flutter/get_location_widget.dart';
|
||||||
|
import 'package:wien_talks_flutter/helper/funmap_mgr.dart';
|
||||||
import 'package:wien_talks_flutter/mapfile_widget.dart';
|
import 'package:wien_talks_flutter/mapfile_widget.dart';
|
||||||
import 'package:wien_talks_flutter/news_input_form.dart';
|
import 'package:wien_talks_flutter/news_input_form.dart';
|
||||||
import 'package:wien_talks_flutter/widgets/screen_widget.dart';
|
import 'package:wien_talks_flutter/widgets/screen_widget.dart';
|
||||||
|
|
@ -15,8 +17,14 @@ class CreateEventScreen extends StatelessWidget {
|
||||||
return ScreenWidget(
|
return ScreenWidget(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
NewsInputForm(),
|
NewsInputForm(
|
||||||
StreamBuilder(stream: LocationMgr().stream, builder: (BuildContext context, AsyncSnapshot<LocationData> snapshot) => Text(snapshot.data.toString())),
|
onSubmit: (CreateQuoteRequest request) async {
|
||||||
|
await FunmapMgr().client.quote.createQuote(request);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
StreamBuilder(
|
||||||
|
stream: LocationMgr().stream,
|
||||||
|
builder: (BuildContext context, AsyncSnapshot<LocationData> snapshot) => snapshot.data != null ? Text(snapshot.data.toString()) : SizedBox()),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: GetLocationWidget(
|
child: GetLocationWidget(
|
||||||
child: MapfileWidget(),
|
child: MapfileWidget(),
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:wien_talks_flutter/create_event_screen.dart';
|
import 'package:wien_talks_flutter/create_event_screen.dart';
|
||||||
import 'package:wien_talks_flutter/news_screen.dart';
|
import 'package:wien_talks_flutter/home_screen.dart';
|
||||||
|
|
||||||
final router = GoRouter(
|
final router = GoRouter(
|
||||||
routes: [
|
routes: [
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: '/',
|
path: '/',
|
||||||
builder: (context, state) => NewsScreen(),
|
builder: (context, state) => HomeScreen(),
|
||||||
),
|
),
|
||||||
GoRoute(path: '/create_event', name: 'create_event', builder: (context, state) => CreateEventScreen()),
|
GoRoute(path: '/create_event', name: 'create_event', builder: (context, state) => CreateEventScreen()),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ 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';
|
||||||
|
|
||||||
class NewsScreen extends StatelessWidget {
|
import 'carousel_widget.dart';
|
||||||
const NewsScreen({
|
|
||||||
|
class HomeScreen extends StatelessWidget {
|
||||||
|
const HomeScreen({
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -21,11 +23,21 @@ class NewsScreen extends StatelessWidget {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.pushNamed("create_event");
|
context.pushNamed("create_event");
|
||||||
},
|
},
|
||||||
child: Text("Submit your own event")),
|
child: Text("Submit your own event")),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
CarouselWidget(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -14,7 +14,7 @@ class MyApp extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp.router(
|
return MaterialApp.router(
|
||||||
title: 'Wien Talks FunMap',
|
title: 'Wien Talks FunMap',
|
||||||
theme: ThemeData(primarySwatch: Colors.blue),
|
theme: ThemeData(primarySwatch: Colors.green),
|
||||||
routerConfig: router,
|
routerConfig: router,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,15 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:loader_overlay/loader_overlay.dart';
|
import 'package:loader_overlay/loader_overlay.dart';
|
||||||
import 'package:location/location.dart';
|
import 'package:location/location.dart';
|
||||||
import 'package:wien_talks_client/wien_talks_client.dart';
|
import 'package:wien_talks_client/wien_talks_client.dart';
|
||||||
import 'package:wien_talks_flutter/helper/funmap_mgr.dart';
|
|
||||||
import 'package:wien_talks_flutter/location_mgr.dart';
|
import 'package:wien_talks_flutter/location_mgr.dart';
|
||||||
import 'package:wien_talks_flutter/widgets/error_snackbar.dart';
|
import 'package:wien_talks_flutter/widgets/error_snackbar.dart';
|
||||||
|
|
||||||
|
typedef OnSubmit = Future<void> Function(CreateQuoteRequest request);
|
||||||
|
|
||||||
class NewsInputForm extends StatefulWidget {
|
class NewsInputForm extends StatefulWidget {
|
||||||
const NewsInputForm({super.key});
|
final OnSubmit onSubmit;
|
||||||
|
|
||||||
|
const NewsInputForm({super.key, required this.onSubmit});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_NewsInputFormState createState() => _NewsInputFormState();
|
_NewsInputFormState createState() => _NewsInputFormState();
|
||||||
|
|
@ -30,17 +33,16 @@ class _NewsInputFormState extends State<NewsInputForm> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
var handler = context.loaderOverlay..show();
|
|
||||||
try {
|
|
||||||
final newsData = CreateQuoteRequest(
|
final newsData = CreateQuoteRequest(
|
||||||
text: _newsController.text.trim(),
|
text: _newsController.text.trim(),
|
||||||
lat: LocationMgr().lastLocation!.latitude!,
|
lat: LocationMgr().lastLocation!.latitude!,
|
||||||
lng: LocationMgr().lastLocation!.longitude!,
|
lng: LocationMgr().lastLocation!.longitude!,
|
||||||
);
|
);
|
||||||
await FunmapMgr().client.quote.createQuote(newsData);
|
var handler = context.loaderOverlay..show();
|
||||||
_newsController.clear();
|
try {
|
||||||
|
await widget.onSubmit(newsData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (mounted) {
|
if (context.mounted) {
|
||||||
ErrorSnackbar().show(context, error.toString());
|
ErrorSnackbar().show(context, error.toString());
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
carousel_slider: ^5.1.1
|
||||||
|
|
||||||
flutter_spinkit: ^5.2.2
|
flutter_spinkit: ^5.2.2
|
||||||
|
|
||||||
google_fonts: ^6.3.0
|
google_fonts: ^6.3.0
|
||||||
|
|
@ -69,6 +71,7 @@ flutter:
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
assets:
|
assets:
|
||||||
|
- assets/funny_images/
|
||||||
- assets/render_themes/
|
- assets/render_themes/
|
||||||
- packages/mapsforge_flutter/assets/patterns/dark_farmland.svg
|
- packages/mapsforge_flutter/assets/patterns/dark_farmland.svg
|
||||||
- packages/mapsforge_flutter/assets/patterns/dark_military.png
|
- packages/mapsforge_flutter/assets/patterns/dark_military.png
|
||||||
|
|
|
||||||