update
This commit is contained in:
124
lib/pages/destination/destination_page.dart
Normal file
124
lib/pages/destination/destination_page.dart
Normal file
@ -0,0 +1,124 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:timeline_tile/timeline_tile.dart';
|
||||
|
||||
|
||||
class DestinationPage extends StatefulWidget {
|
||||
DestinationPage({ Key? key }) : super(key: key);
|
||||
|
||||
@override
|
||||
State<DestinationPage> createState() => _DestinationPageState();
|
||||
}
|
||||
|
||||
class _DestinationPageState extends State<DestinationPage> {
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||
|
||||
Image getImage(int index){
|
||||
if(destinationController.destinations[index]["location"]["properties"]["photos"] == null || destinationController.destinations[index]["location"]["properties"]["photos"] == ""){
|
||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(destinationController.destinations[index]["location"]["properties"]["photos"]));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||
final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
||||
return Scaffold(
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
if(indexController.currentUser.isNotEmpty){
|
||||
Get.toNamed(AppPages.TRAVEL);
|
||||
}
|
||||
else{
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
}
|
||||
}),),
|
||||
],
|
||||
),
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: (){
|
||||
indexController.toggleMode();
|
||||
if(indexController.currentCat.isNotEmpty){
|
||||
print("###############");
|
||||
print(indexController.currentCat[0].toString());
|
||||
}
|
||||
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.document_scanner),
|
||||
elevation: 4.0,
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
appBar:AppBar(
|
||||
title: Text("Iternery"),
|
||||
),
|
||||
body:Obx(() =>
|
||||
ReorderableListView.builder(
|
||||
itemCount: destinationController.destinations.length,
|
||||
onReorder: (int oldIndex, int newIndex){
|
||||
int action_id = destinationController.destinations[oldIndex]["id"] as int;
|
||||
//print(action_id);
|
||||
if(oldIndex > newIndex){
|
||||
destinationController.makeOrder(context, action_id, newIndex, "up");
|
||||
}
|
||||
else if(oldIndex < newIndex){
|
||||
destinationController.makeOrder(context, action_id, newIndex, "down");
|
||||
}
|
||||
|
||||
},
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return TimelineTile(
|
||||
alignment: TimelineAlign.manual,
|
||||
lineXY: 0.2,
|
||||
isFirst: index == 0 ? true : false,
|
||||
indicatorStyle: IndicatorStyle(
|
||||
color: Colors.red //index == 0 ? (Colors.red)! : (Colors.grey[400])!
|
||||
),
|
||||
key: Key(index.toString()),
|
||||
endChild: Card(
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 80,
|
||||
),
|
||||
child: ListTile(
|
||||
leading: getImage(index),
|
||||
title: Text(destinationController.destinations[index]["location"]["properties"]["location_name"]),
|
||||
subtitle: Text(destinationController.destinations[index]["location"]["properties"]["category"]),
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
startChild: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text("12:30"),
|
||||
Text("01:20"),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user