Skip to content

Commit

Permalink
Merge pull request #1 from nerufuyo/dev_detail
Browse files Browse the repository at this point in the history
Dev detail
  • Loading branch information
nerufuyo committed Jun 30, 2022
2 parents ea5a284 + 0411df4 commit 9e4599d
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 22 deletions.
14 changes: 14 additions & 0 deletions lib/data/model/packerin_favorite_page_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:packerin/data/model/packerin_destination.dart';
import 'package:flutter/foundation.dart';

class PackerinFavoritePageModel extends ChangeNotifier {
late PackerinDestination _destinationList;
final List<String> _itemIds = [];

PackerinDestination get destination => _destinationList;

set destination(PackerinDestination newList) {
_destinationList = newList;
notifyListeners();
}
}
29 changes: 18 additions & 11 deletions lib/presentation/pages/packerin_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:packerin/common/style.dart';
import 'package:packerin/data/model/packerin_destination_list_model.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:packerin/presentation/widgets/packerin_favorite_button.dart';

class PackerinDetailPage extends StatefulWidget {
static const routeName = '/packerin-detail-page';
Expand Down Expand Up @@ -120,18 +121,24 @@ class _PackerinDetailPageState extends State<PackerinDetailPage> {
),
),
SafeArea(
child: Padding(
padding: const EdgeInsets.all(10),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios_new_rounded,
color: Colors.red,
size: 30,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.all(10),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios_new_rounded,
color: Colors.red,
size: 30,
),
),
),
),
const FavoriteButton(),
],
),
),
],
Expand Down
25 changes: 17 additions & 8 deletions lib/presentation/widgets/packerin_card_widget.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:packerin/data/model/packerin_destination_list_model.dart';
import 'package:packerin/presentation/widgets/packerin_favorite_button.dart';

class PackerinCardWidget extends StatelessWidget {
const PackerinCardWidget({
Expand Down Expand Up @@ -45,14 +46,22 @@ class PackerinCardWidget extends StatelessWidget {
children: [
ClipRRect(
borderRadius: BorderRadius.circular(15),
child: Hero(
tag: destination[index].id,
child: Image.network(
destination[index].pictureId,
width: 330,
height: 340,
fit: BoxFit.cover,
),
child: Stack(
children: [
Hero(
tag: destination[index].id,
child: Image.network(
destination[index].pictureId,
width: 330,
height: 340,
fit: BoxFit.cover,
),
),
const Positioned(
right: 0.0,
child: FavoriteButton(),
),
],
),
),
const SizedBox(
Expand Down
29 changes: 29 additions & 0 deletions lib/presentation/widgets/packerin_favorite_button.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';

class FavoriteButton extends StatefulWidget {
const FavoriteButton({Key? key}) : super(key: key);

@override
State<FavoriteButton> createState() => _FavoriteButtonState();
}

class _FavoriteButtonState extends State<FavoriteButton> {
bool isFavorite = false;

@override
Widget build(BuildContext context) {
return IconButton(
icon: Icon(
isFavorite ? Icons.favorite : Icons.favorite_border,
color: Colors.red,
),
onPressed: () {
setState(
() {
isFavorite = !isFavorite;
},
);
},
);
}
}
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
version: "1.15.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -112,7 +112,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.2.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -561,5 +561,5 @@ packages:
source: hosted
version: "3.7.0"
sdks:
dart: ">=2.17.0-0 <3.0.0"
dart: ">=2.16.2 <3.0.0"
flutter: ">=2.10.0-0"

0 comments on commit 9e4599d

Please sign in to comment.