mirror of
https://github.com/SoPat712/RUSwipeShare.git
synced 2025-08-21 19:08:46 -04:00
dialog and other ui fixes
This commit is contained in:
292
lib/buy.dart
292
lib/buy.dart
@@ -1,11 +1,6 @@
|
|||||||
import 'dart:collection';
|
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:material_dialogs/shared/types.dart';
|
|
||||||
import 'package:material_dialogs/widgets/buttons/icon_button.dart';
|
|
||||||
import 'package:material_dialogs/widgets/buttons/icon_outline_button.dart';
|
|
||||||
import 'package:material_dialogs/material_dialogs.dart';
|
|
||||||
import 'package:ruswipeshare/main.dart';
|
import 'package:ruswipeshare/main.dart';
|
||||||
|
|
||||||
enum CampusState { campuses, list_options, offers }
|
enum CampusState { campuses, list_options, offers }
|
||||||
@@ -293,63 +288,64 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showSheet(context, index);
|
||||||
context: context,
|
// showDialog(
|
||||||
builder: (BuildContext context) => Dialog(
|
// context: context,
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
// builder: (BuildContext context) => Dialog(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
|
// backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
child: Padding(
|
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(20))),
|
||||||
padding: const EdgeInsets.all(8.0),
|
// child: Padding(
|
||||||
child: Column(
|
// padding: const EdgeInsets.all(8.0),
|
||||||
mainAxisSize: MainAxisSize.min,
|
// child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
const Text('Transaction Details'),
|
// children: <Widget>[
|
||||||
const SizedBox(height: 15),
|
// const Text('Transaction Details'),
|
||||||
TextButton(
|
// const SizedBox(height: 15),
|
||||||
onPressed: () {
|
// TextButton(
|
||||||
Navigator.pop(context);
|
// onPressed: () {
|
||||||
},
|
// Navigator.pop(context);
|
||||||
child: const Text('Close'),
|
// },
|
||||||
),
|
// child: const Text('Close'),
|
||||||
],
|
// ),
|
||||||
),
|
// ],
|
||||||
)));
|
// ),
|
||||||
// Dialogs.materialDialog(
|
// )));
|
||||||
// color: Theme.of(context).scaffoldBackgroundColor,
|
// // Dialogs.materialDialog(
|
||||||
// customView: const TransactionDetails(),
|
// // color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
// customViewPosition:
|
// // customView: const TransactionDetails(),
|
||||||
// CustomViewPosition.BEFORE_ACTION,
|
// // customViewPosition:
|
||||||
// msgAlign: TextAlign.center,
|
// // CustomViewPosition.BEFORE_ACTION,
|
||||||
// msg:
|
// // msgAlign: TextAlign.center,
|
||||||
// 'Please read all the information below before purchasing.\n',
|
// // msg:
|
||||||
// title: 'Transaction Details',
|
// // 'Please read all the information below before purchasing.\n',
|
||||||
// context: context,
|
// // title: 'Transaction Details',
|
||||||
// actions: [
|
// // context: context,
|
||||||
// IconsOutlineButton(
|
// // actions: [
|
||||||
// onPressed: () {},
|
// // IconsOutlineButton(
|
||||||
// text: 'Cancel',
|
// // onPressed: () {},
|
||||||
// iconData: Icons.cancel_outlined,
|
// // text: 'Cancel',
|
||||||
// color: Theme.of(context).primaryColor,
|
// // iconData: Icons.cancel_outlined,
|
||||||
// textStyle: TextStyle(
|
// // color: Theme.of(context).primaryColor,
|
||||||
// color: CustomMaterialColor(240, 240, 240)
|
// // textStyle: TextStyle(
|
||||||
// .mdColor,
|
// // color: CustomMaterialColor(240, 240, 240)
|
||||||
// ),
|
// // .mdColor,
|
||||||
// iconColor: CustomMaterialColor(240, 240, 240)
|
// // ),
|
||||||
// .mdColor),
|
// // iconColor: CustomMaterialColor(240, 240, 240)
|
||||||
// IconsButton(
|
// // .mdColor),
|
||||||
// onPressed: () {},
|
// // IconsButton(
|
||||||
// text: 'Purchase',
|
// // onPressed: () {},
|
||||||
// iconData: Icons.done,
|
// // text: 'Purchase',
|
||||||
// color: Colors.green,
|
// // iconData: Icons.done,
|
||||||
// textStyle: TextStyle(
|
// // color: Colors.green,
|
||||||
// color: CustomMaterialColor(240, 240, 240)
|
// // textStyle: TextStyle(
|
||||||
// .mdColor,
|
// // color: CustomMaterialColor(240, 240, 240)
|
||||||
// ),
|
// // .mdColor,
|
||||||
// iconColor: CustomMaterialColor(240, 240, 240)
|
// // ),
|
||||||
// .mdColor),
|
// // iconColor: CustomMaterialColor(240, 240, 240)
|
||||||
// ],
|
// // .mdColor),
|
||||||
// );
|
// // ],
|
||||||
|
// // );
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(border: Border.all(color: CustomMaterialColor(240, 240, 240).mdColor, width: 2), borderRadius: const BorderRadius.all(Radius.circular(10))),
|
decoration: BoxDecoration(border: Border.all(color: CustomMaterialColor(240, 240, 240).mdColor, width: 2), borderRadius: const BorderRadius.all(Radius.circular(10))),
|
||||||
@@ -434,6 +430,155 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<dynamic> showSheet(BuildContext context, int index) {
|
||||||
|
return showModalBottomSheet(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 0),
|
||||||
|
child: Container(
|
||||||
|
height: 400,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(15),
|
||||||
|
topRight: Radius.circular(15),
|
||||||
|
),
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.fromLTRB(
|
||||||
|
18,
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
25,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Transaction Details",
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontFamily: 'Proxima',
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// ListTile(
|
||||||
|
// leading: const Icon(
|
||||||
|
// Icons.home,
|
||||||
|
// ),
|
||||||
|
// onTap: () async {
|
||||||
|
// Navigator.pop(context);
|
||||||
|
|
||||||
|
// if (myPlacesIds[index] != myHomeId) {
|
||||||
|
// scrollController.animateTo(0,
|
||||||
|
// duration: const Duration(milliseconds: 400),
|
||||||
|
// curve: Curves.easeInOutCirc);
|
||||||
|
// myHomeFullName = myPlacesFullName[index];
|
||||||
|
// myHomeId = myPlacesIds[index];
|
||||||
|
// myHomeMainText = myPlacesMainText[index];
|
||||||
|
// myHomeSecondaryText = myPlacesSecondaryText[index];
|
||||||
|
// if (index != 0) {
|
||||||
|
// myPlacesIds.insert(0, myHomeId);
|
||||||
|
// myPlacesFullName.insert(0, myHomeFullName);
|
||||||
|
// myPlacesMainText.insert(0, myHomeMainText);
|
||||||
|
// myPlacesSecondaryText.insert(0, myHomeSecondaryText);
|
||||||
|
// _listKey.currentState!.insertItem(0,
|
||||||
|
// duration: const Duration(milliseconds: 200));
|
||||||
|
|
||||||
|
// await Future.delayed(const Duration(milliseconds: 200),
|
||||||
|
// () async {
|
||||||
|
// myPlacesFullName.removeAt(index + 1);
|
||||||
|
// myPlacesMainText.removeAt(index + 1);
|
||||||
|
// myPlacesSecondaryText.removeAt(index + 1);
|
||||||
|
// myPlacesIds.removeAt(index + 1);
|
||||||
|
// _listKey.currentState!.removeItem(
|
||||||
|
// index + 1,
|
||||||
|
// (context, animation) {
|
||||||
|
// return _buildLocTileOutAnimate(
|
||||||
|
// context,
|
||||||
|
// animation,
|
||||||
|
// myPlacesMainText[0],
|
||||||
|
// myPlacesSecondaryText[0],
|
||||||
|
// true);
|
||||||
|
// },
|
||||||
|
// duration: const Duration(milliseconds: 200),
|
||||||
|
// );
|
||||||
|
// indexrem = index;
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// myHomeFullName = myPlacesFullName[index];
|
||||||
|
// myHomeId = myPlacesIds[index];
|
||||||
|
// myHomeMainText = myPlacesMainText[index];
|
||||||
|
// myHomeSecondaryText = myPlacesSecondaryText[index];
|
||||||
|
// setState(() {});
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// myHomeId = "";
|
||||||
|
// myHomeFullName = "";
|
||||||
|
// myHomeSecondaryText = "";
|
||||||
|
// myHomeMainText = "";
|
||||||
|
// setState(() {});
|
||||||
|
// }
|
||||||
|
// _saveHome();
|
||||||
|
// _saveList();
|
||||||
|
// },
|
||||||
|
// title: Text(
|
||||||
|
// (myPlacesIds[index] != myHomeId)
|
||||||
|
// ? "Set as Home"
|
||||||
|
// : "Remove as home",
|
||||||
|
// style: const TextStyle(
|
||||||
|
// fontFamily: 'Proxima',
|
||||||
|
// fontSize: 18,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
|
"Cancel",
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontFamily: 'Proxima',
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
)),
|
||||||
|
// add close button
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: Text(
|
||||||
|
"Purchase",
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontFamily: 'Proxima',
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TransactionDetails extends StatefulWidget {
|
class TransactionDetails extends StatefulWidget {
|
||||||
@@ -452,3 +597,26 @@ class _TransactionDetailsState extends State<TransactionDetails> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class CustomMaterialColor {
|
||||||
|
final int r;
|
||||||
|
final int g;
|
||||||
|
final int b;
|
||||||
|
|
||||||
|
CustomMaterialColor(this.r, this.g, this.b);
|
||||||
|
|
||||||
|
MaterialColor get mdColor {
|
||||||
|
Map<int, Color> color = {
|
||||||
|
50: Color.fromRGBO(r, g, b, .1),
|
||||||
|
100: Color.fromRGBO(r, g, b, .2),
|
||||||
|
200: Color.fromRGBO(r, g, b, .3),
|
||||||
|
300: Color.fromRGBO(r, g, b, .4),
|
||||||
|
400: Color.fromRGBO(r, g, b, .5),
|
||||||
|
500: Color.fromRGBO(r, g, b, .6),
|
||||||
|
600: Color.fromRGBO(r, g, b, .7),
|
||||||
|
700: Color.fromRGBO(r, g, b, .8),
|
||||||
|
800: Color.fromRGBO(r, g, b, .9),
|
||||||
|
900: Color.fromRGBO(r, g, b, 1),
|
||||||
|
};
|
||||||
|
return MaterialColor(Color.fromRGBO(r, g, b, 1).value, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -104,3 +104,26 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class CustomMaterialColor {
|
||||||
|
final int r;
|
||||||
|
final int g;
|
||||||
|
final int b;
|
||||||
|
|
||||||
|
CustomMaterialColor(this.r, this.g, this.b);
|
||||||
|
|
||||||
|
MaterialColor get mdColor {
|
||||||
|
Map<int, Color> color = {
|
||||||
|
50: Color.fromRGBO(r, g, b, .1),
|
||||||
|
100: Color.fromRGBO(r, g, b, .2),
|
||||||
|
200: Color.fromRGBO(r, g, b, .3),
|
||||||
|
300: Color.fromRGBO(r, g, b, .4),
|
||||||
|
400: Color.fromRGBO(r, g, b, .5),
|
||||||
|
500: Color.fromRGBO(r, g, b, .6),
|
||||||
|
600: Color.fromRGBO(r, g, b, .7),
|
||||||
|
700: Color.fromRGBO(r, g, b, .8),
|
||||||
|
800: Color.fromRGBO(r, g, b, .9),
|
||||||
|
900: Color.fromRGBO(r, g, b, 1),
|
||||||
|
};
|
||||||
|
return MaterialColor(Color.fromRGBO(r, g, b, 1).value, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class MyApp extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomMaterialColor {
|
class CustomMaterialColor {
|
||||||
final int r;
|
final int r;
|
||||||
final int g;
|
final int g;
|
||||||
final int b;
|
final int b;
|
||||||
|
@@ -145,20 +145,7 @@ class _SellScreenState extends State<SellScreen> {
|
|||||||
Text('Cost'),
|
Text('Cost'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
//make a row with a text selector for min and max swipe cost
|
SizedBox(
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: const [
|
|
||||||
SizedBox(
|
|
||||||
width: 150,
|
|
||||||
child: TextField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
hintText: 'Min price',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 150,
|
width: 150,
|
||||||
child: TextField(
|
child: TextField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -167,8 +154,6 @@ class _SellScreenState extends State<SellScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
|
Reference in New Issue
Block a user