fix display name in database

This commit is contained in:
Ashish Bailkeri
2023-02-26 13:56:21 -05:00
parent d00c9cb5b9
commit bba9c5a4cc
2 changed files with 18 additions and 8 deletions

View File

@@ -17,7 +17,7 @@ class PriceRange {
}
class Seller implements Comparable<Seller> {
String name = "";
String? name = "Unknown Seller";
String uid = "";
List<dynamic> location;
TimeRange availableTime;

View File

@@ -46,7 +46,8 @@ class _SellScreenState extends State<SellScreen> {
resizeToAvoidBottomInset: true,
body: Padding(
padding: const EdgeInsets.fromLTRB(0, 8, 0, 0),
child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
child:
Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
@@ -101,7 +102,9 @@ class _SellScreenState extends State<SellScreen> {
children: [
ElevatedButton(
onPressed: () async {
DatePicker.showDateTimePicker(context, showTitleActions: true, minTime: DateTime.now(), onChanged: (date) {
DatePicker.showDateTimePicker(context,
showTitleActions: true,
minTime: DateTime.now(), onChanged: (date) {
print('change $date');
}, onConfirm: (date) {
setState(() {
@@ -125,7 +128,9 @@ class _SellScreenState extends State<SellScreen> {
),
ElevatedButton(
onPressed: () async {
DatePicker.showDateTimePicker(context, showTitleActions: true, minTime: DateTime.now(), onChanged: (date) {
DatePicker.showDateTimePicker(context,
showTitleActions: true,
minTime: DateTime.now(), onChanged: (date) {
print('change $date');
}, onConfirm: (date) {
setState(() {
@@ -178,14 +183,19 @@ class _SellScreenState extends State<SellScreen> {
if (value == true) locations.add(key);
});
if (user != null) {
Seller seller = Seller("", user.uid, locations, TimeRange(Timestamp.fromDate(startTimeTime), Timestamp.fromDate(endTimeTime)), double.parse(priceController.text));
print("SIFSIFISFHJIS");
print(seller);
Seller seller = Seller(
user.displayName,
user.uid,
locations,
TimeRange(Timestamp.fromDate(startTimeTime),
Timestamp.fromDate(endTimeTime)),
double.parse(priceController.text));
addSeller(seller);
}
},
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith((states) => Colors.blue),
backgroundColor:
MaterialStateColor.resolveWith((states) => Colors.blue),
),
child: const Text('Submit Sell Request'),
),