first ui elements using the new structs
This commit is contained in:
70
frontend/lib/pages/overview.dart
Normal file
70
frontend/lib/pages/overview.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:fast_network_navigation/modules/greeter.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
||||
|
||||
import 'package:fast_network_navigation/modules/landmarks_overview.dart';
|
||||
import 'package:fast_network_navigation/modules/map.dart';
|
||||
|
||||
|
||||
|
||||
class NavigationOverview extends StatefulWidget {
|
||||
@override
|
||||
State<NavigationOverview> createState() => _NavigationOverviewState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _NavigationOverviewState extends State<NavigationOverview> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return SlidingUpPanel(
|
||||
renderPanelSheet: false,
|
||||
panel: _floatingPanel(theme),
|
||||
collapsed: _floatingCollapsed(theme),
|
||||
body: MapWidget()
|
||||
);
|
||||
}
|
||||
|
||||
Widget _floatingCollapsed(ThemeData theme){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.canvasColor,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(24.0), topRight: Radius.circular(24.0)),
|
||||
boxShadow: []
|
||||
),
|
||||
|
||||
child: Greeter(theme)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _floatingPanel(ThemeData theme){
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.0)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 20.0,
|
||||
color: theme.shadowColor,
|
||||
),
|
||||
]
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Greeter(theme, full: true),
|
||||
loadLandmarksOverview(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
91
frontend/lib/pages/profile.dart
Normal file
91
frontend/lib/pages/profile.dart
Normal file
@@ -0,0 +1,91 @@
|
||||
import 'package:fast_network_navigation/structs/preferences.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
|
||||
class ProfilePage extends StatefulWidget {
|
||||
@override
|
||||
_ProfilePageState createState() => _ProfilePageState();
|
||||
}
|
||||
|
||||
class _ProfilePageState extends State<ProfilePage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
children: [
|
||||
// First a round, centered image
|
||||
Center(
|
||||
child: CircleAvatar(
|
||||
radius: 100,
|
||||
child: Icon(Icons.person, size: 100),
|
||||
)
|
||||
),
|
||||
Center(
|
||||
child: Text('Curious traveler', style: TextStyle(fontSize: 24))
|
||||
),
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
),
|
||||
|
||||
Text('Please rate your preferences for the following activities:'),
|
||||
|
||||
// Now the sliders
|
||||
ImportanceSliders()
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class ImportanceSliders extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State<ImportanceSliders> createState() => _ImportanceSlidersState();
|
||||
}
|
||||
|
||||
|
||||
class _ImportanceSlidersState extends State<ImportanceSliders> {
|
||||
|
||||
UserPreferences _prefs = UserPreferences();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_prefs.load();
|
||||
}
|
||||
|
||||
List<Card> _createSliders() {
|
||||
List<Card> sliders = [];
|
||||
for (SinglePreference pref in _prefs.preferences) {
|
||||
sliders.add(Card(
|
||||
child: ListTile(
|
||||
leading: pref.icon,
|
||||
title: Text(pref.name),
|
||||
subtitle: Slider(
|
||||
value: pref.value.toDouble(),
|
||||
min: 0,
|
||||
max: 10,
|
||||
divisions: 10,
|
||||
label: pref.value.toString(),
|
||||
onChanged: (double newValue) {
|
||||
setState(() {
|
||||
pref.value = newValue.toInt();
|
||||
_prefs.save();
|
||||
});
|
||||
},
|
||||
)
|
||||
),
|
||||
margin: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 0),
|
||||
shadowColor: Colors.grey,
|
||||
));
|
||||
}
|
||||
return sliders;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(children: _createSliders());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user