Untitled
unknown
plain_text
3 years ago
12 kB
8
Indexable
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).copyWith().size;
final DateFormat formatter = DateFormat('MMM dd');
AppBar appBar = AppBar(
leading: GestureDetector(
child: CloseIcon(isBack: true),
onTap: () => {
Navigator.of(context).pop(),
},
),
title: GestureDetector(
onTap: () => {
openCategoryDialog(size),
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
selectedCategory == '' ? 'Category' : selectedCategory,
style: TextStyle(
fontSize: 18,
color: KalanaColors.text,
),
),
Icon(
Icons.arrow_drop_down,
color: KalanaColors.text,
),
],
),
),
actions: [
PopupMenuButton(
onSelected: (value) {
sortSelected(value);
},
icon: Icon(
Icons.sort,
color: KalanaColors.secondary,
),
color: KalanaColors.light,
itemBuilder: (_) => [
PopupMenuItem(
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
right: size.width * 0.025,
),
child: Icon(
Icons.location_searching,
color: KalanaColors.secondary,
),
),
Text('Near Me'),
],
),
value: 'near',
),
PopupMenuItem(
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
right: size.width * 0.025,
),
child: Icon(
Icons.arrow_downward,
color: KalanaColors.secondary,
),
),
Text('High to Low'),
],
),
value: 'high-to-low',
),
PopupMenuItem(
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
right: size.width * 0.025,
),
child: Icon(
Icons.arrow_upward,
color: KalanaColors.secondary,
),
),
Text('Low to High'),
],
),
value: 'low-to-high',
),
PopupMenuItem(
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.only(
right: size.width * 0.025,
),
child: Icon(
Icons.account_circle,
color: KalanaColors.secondary,
),
),
Text('Name'),
],
),
value: 'name',
),
],
),
],
backgroundColor: Colors.transparent,
elevation: 0,
);
// double pillSize = size.width * 0.275;
double pillSize = size.width * 0.31;
return Scaffold(
appBar: appBar,
body:
SafeArea(
bottom: false,
// child: SingleChildScrollView(
child: NestedScrollView(
body: Builder(builder: (context) => Center(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.center,
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
InkWell(
borderRadius: BorderRadius.circular(size.width),
onTap: () {
openDateSelector(size, updateDates);
},
child: Container(
width: pillSize,
padding: EdgeInsets.symmetric(
horizontal: size.width * 0.025,
vertical: size.width * 0.01,
),
decoration: BoxDecoration(
color: selectedDateRange.length == 0
? KalanaColors.light
: KalanaColors.secondary,
border: Border.all(
color: KalanaColors.secondary,
),
borderRadius:
BorderRadius.circular(size.width * 0.3),
),
child: Center(
child: Text(
selectedDateRange.length == 0
? 'Dates'
: selectedDateRange.length == 1
? formatter
.format(selectedDateRange.first)
: formatter.format(
selectedDateRange.first) +
'-' +
formatter.format(
selectedDateRange.last),
textAlign: TextAlign.center,
style: TextStyle(
color: selectedDateRange.length == 0
? KalanaColors.secondary
: KalanaColors.light,
fontSize: 13,
),
),
),
),
),
InkWell(
borderRadius: BorderRadius.circular(size.width),
onTap: () {
openLocationSearch(size);
},
child: Container(
width: pillSize,
padding: EdgeInsets.symmetric(
horizontal: size.width * 0.025,
vertical: size.width * 0.01,
),
decoration: BoxDecoration(
color: latLng == null
? KalanaColors.light
: KalanaColors.secondary,
border: Border.all(
color: KalanaColors.secondary,
),
borderRadius:
BorderRadius.circular(size.width * 0.3),
),
child: Center(
child: Text(
latLng == null
? 'Location'
: '${distance.toStringAsFixed(0)} miles',
textAlign: TextAlign.center,
style: TextStyle(
color: latLng == null
? KalanaColors.secondary
: KalanaColors.light,
fontSize: 13,
),
),
),
),
),
InkWell(
borderRadius: BorderRadius.circular(size.width),
onTap: () {
openPriceSearch(size);
},
child: Container(
width: pillSize,
padding: EdgeInsets.symmetric(
horizontal: size.width * 0.025,
vertical: size.width * 0.01,
),
decoration: BoxDecoration(
color: priceRange.start == rangeMin &&
priceRange.end == rangeMax
? KalanaColors.light
: KalanaColors.secondary,
border: Border.all(
color: KalanaColors.secondary,
),
borderRadius:
BorderRadius.circular(size.width * 0.3),
),
child: Center(
child: Text(
priceRange.start == rangeMin &&
priceRange.end == rangeMax
? 'Price'
: '\$${priceRange.start.toStringAsFixed(0)} - \$${priceRange.end.toStringAsFixed(0)}',
textAlign: TextAlign.center,
style: TextStyle(
color: priceRange.start == rangeMin &&
priceRange.end == rangeMax
? KalanaColors.secondary
: KalanaColors.light,
fontSize: 13,
),
),
),
),
),
],
),
],
),
),
SortResults(
sortSelected: sortSelected,
searched: searched,
numSearchResults: numSearchResults,
),
Container(
width: size.width * .9,
child: rentals == null || rentals.isEmpty
? Container()
: ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: rentals == null ? 0 : rentals.length,
itemBuilder: (context, index) {
print(index);
return RentalListing(
rentalItem: rentals[index],
isEven: index % 2 == 0,
myListing: false,
bottomNavTapped: widget.bottomNavTapped,
updateRental: updateRental,
);
},
),
),
],
),
),
),
),
));
}Editor is loading...