Add stars to review list

Co-authored-by: Reimar <mail@reim.ar>
This commit is contained in:
Alexandertp 2024-09-05 18:39:43 +02:00
parent 0dcfb2ea1e
commit d767e0bb85

View File

@ -19,57 +19,65 @@ class _ReviewListState extends State<ReviewListPage> {
return SideMenu( return SideMenu(
selectedIndex: -1, selectedIndex: -1,
body: Scaffold(body: SingleChildScrollView(child: Container( body: Scaffold(
decoration: const BoxDecoration(color: Color(0xFFF9F9F9)), backgroundColor: Color(0xFFF9F9F9),
width: MediaQuery.of(context).size.width, body: SingleChildScrollView(child: Container(
padding: const EdgeInsets.all(20.0), decoration: const BoxDecoration(color: Color(0xFFF9F9F9)),
child: Column(children: width: MediaQuery.of(context).size.width,
reviews.map((review) => Container( padding: const EdgeInsets.all(20.0),
width: double.infinity, child: Column(children:
padding: const EdgeInsets.all(20), reviews.map((review) => Container(
margin: const EdgeInsets.only(bottom: 10), width: double.infinity,
decoration: const BoxDecoration( padding: const EdgeInsets.all(20),
boxShadow: [ margin: const EdgeInsets.only(bottom: 10),
BoxShadow( decoration: const BoxDecoration(
color: Color(0x20000000), boxShadow: [
offset: Offset(0,1), BoxShadow(
blurRadius: 4, color: Color(0x20000000),
), offset: Offset(0,1),
], blurRadius: 4,
color: Colors.white,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.only(top: 3),
child: Icon(Icons.radio, color: Colors.purple, size: 36),
),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(review.title, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24)),
Text(review.content),
],
), ),
), ],
], color: Colors.white,
) ),
)).toList(), child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.only(top: 3),
child: Icon(Icons.radio, color: Colors.purple, size: 36),
),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(review.title, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 24)),
Text(review.content),
const SizedBox(height: 10),
Row(children: [
for (var i = 0; i < review.rating; i++) const Icon(Icons.star, color: Colors.yellow),
for (var i = review.rating; i < 5; i++) const Icon(Icons.star_border),
]),
],
),
),
],
),
)).toList(),
),
)),
floatingActionButton: FloatingActionButton(
onPressed: () async {
final review = await Navigator.pushNamed(context, '/create-review', arguments: place) as Review?;
if (review != null) reviews.add(review);
},
backgroundColor: Colors.blue,
focusColor: Colors.blueGrey,
tooltip: "Write a Review",
child: const Icon(CupertinoIcons.plus),
), ),
)),
floatingActionButton: FloatingActionButton(
onPressed: () async {
final review = await Navigator.pushNamed(context, '/create-review', arguments: place) as Review?;
if (review != null) reviews.add(review);
},
backgroundColor: Colors.blue,
focusColor: Colors.blueGrey,
tooltip: "Write a Review",
child: const Icon(CupertinoIcons.plus),
), ),
)); );
} }
} }