-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from letterbookd/review
Update dev branch with latest review layouts
- Loading branch information
Showing
6 changed files
with
323 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
// ignore_for_file: non_constant_identifier_names | ||
|
||
class Review { | ||
int stars_rating; | ||
int total_rating; | ||
String status_on_review; | ||
String review_text; | ||
class Review{ | ||
int starsRating; | ||
int totalRating; | ||
String statusOnReview; | ||
String reviewText; | ||
|
||
Review( | ||
this.stars_rating, | ||
this.total_rating, | ||
this.status_on_review, | ||
this.review_text, | ||
); | ||
} | ||
|
||
Review( | ||
this.starsRating, | ||
this.totalRating, | ||
this.statusOnReview, | ||
this.reviewText, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import 'dart:convert'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:pbp_django_auth/pbp_django_auth.dart'; | ||
import 'package:provider/provider.dart'; | ||
|
||
class EditFormPage extends StatefulWidget { | ||
const EditFormPage({super.key}); | ||
|
||
@override | ||
State<EditFormPage> createState() => _EditFormPageState(); | ||
} | ||
|
||
class _EditFormPageState extends State<EditFormPage> { | ||
final _formKey = GlobalKey<FormState>(); | ||
String _statusOnReview = ""; | ||
int _starsRating = 0; | ||
String _reviewText = ""; | ||
|
||
void _submitForm() { | ||
if (_formKey.currentState!.validate()) { | ||
// Handle form submission here | ||
print('Status on Review: $_statusOnReview'); | ||
print('Stars Rating: $_starsRating'); | ||
print('Review Text: $_reviewText'); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final request = context.watch<CookieRequest>(); | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Center( | ||
child: Text( | ||
'Form Edit Review', | ||
), | ||
), | ||
backgroundColor: Colors.indigo, | ||
foregroundColor: Colors.white, | ||
), | ||
body: Form( | ||
key: _formKey, | ||
child: SingleChildScrollView( | ||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: DropdownButtonFormField<String>( | ||
value: _statusOnReview, | ||
decoration: InputDecoration( | ||
labelText: "Status on Review", | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(5.0), | ||
), | ||
), | ||
items: <String>[ | ||
'FINISHED', | ||
'READING', | ||
'ON HOLD', | ||
'PLANNED', | ||
'DROPPED', | ||
'UNTRACKED' | ||
].map<DropdownMenuItem<String>>((String value) { | ||
return DropdownMenuItem<String>( | ||
value: value, | ||
child: Text(value), | ||
); | ||
}).toList(), | ||
onChanged: (String? newValue) { | ||
setState(() { | ||
_statusOnReview = newValue!; | ||
}); | ||
}, | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: TextFormField( | ||
decoration: InputDecoration( | ||
hintText: "Rating", | ||
labelText: "Rating", | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(5.0), | ||
), | ||
), | ||
onChanged: (String? value) { | ||
setState(() { | ||
_starsRating = int.parse(value!); | ||
}); | ||
}, | ||
validator: (String? value) { | ||
if (value == null || value.isEmpty) { | ||
return "Shouldn't be Empty!"; | ||
} | ||
if (int.tryParse(value) == null) { | ||
return "Should be an Integer"; | ||
} | ||
return null; | ||
}, | ||
), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: TextFormField( | ||
decoration: InputDecoration( | ||
hintText: "Review Text", | ||
labelText: "Review Text", | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(5.0), | ||
), | ||
), | ||
onChanged: (String? value) { | ||
setState(() { | ||
_reviewText = value!; | ||
}); | ||
}, | ||
validator: (String? value) { | ||
if (value == null || value.isEmpty) { | ||
return "Shouldn't be Empty!"; | ||
} | ||
return null; | ||
}, | ||
), | ||
), | ||
Align( | ||
alignment: Alignment.bottomCenter, | ||
child: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: ElevatedButton( | ||
style: ButtonStyle( | ||
backgroundColor: MaterialStateProperty.all(Colors.indigo), | ||
), | ||
onPressed: _submitForm, | ||
child: const Text('Submit'), | ||
), | ||
), | ||
), | ||
]), | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.