Skip to content

Commit

Permalink
Some improvement
Browse files Browse the repository at this point in the history
sinasystem committed Jun 28, 2022
1 parent 13ff1cd commit 20a95e4
Showing 6 changed files with 24 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -23,5 +23,5 @@ jobs:
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/apk/release/app-release.apk"
tag: v2.0.2
tag: v2.0.3
token: ${{ secrets.TOKEN }}
22 changes: 9 additions & 13 deletions lib/src/view/screen/cart_screen.dart
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ class CartScreen extends StatelessWidget {
() {
return BottomBar(
priceLabel: "Total price",
priceValue: "\$${controller.totalPrice.value}",
priceValue: "\$${controller.totalPrice.value.toStringAsFixed(2)}",
buttonLabel: "Checkout",
onTap: controller.totalPrice > 0 ? () {} : null,
);
@@ -47,18 +47,14 @@ class CartScreen extends StatelessWidget {
return controller.cartFurniture.isNotEmpty
? Padding(
padding: const EdgeInsets.all(15),
child: CartListView(counterButton: (furniture) {
return GetBuilder(
builder: (OfficeFurnitureController controller) {
return CounterButton(
orientation: Axis.vertical,
onIncrementSelected: () =>
controller.increaseItem(furniture),
onDecrementSelected: () =>
controller.decreaseItem(furniture),
label: furniture.quantity);
},
);
child: CartListView(furnitureItems: controller.cartFurniture,counterButton: (furniture) {
return CounterButton(
orientation: Axis.vertical,
onIncrementSelected: () =>
controller.increaseItem(furniture),
onDecrementSelected: () =>
controller.decreaseItem(furniture),
label: furniture.quantity);
}),
)
: const EmptyWidget(title: "Empty");
17 changes: 5 additions & 12 deletions lib/src/view/screen/home_screen.dart
Original file line number Diff line number Diff line change
@@ -11,17 +11,10 @@ import '../../controller/office_furniture_controller.dart';
final OfficeFurnitureController controller =
Get.put(OfficeFurnitureController());

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

@override
State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
int selectedIndex = 0;

List<Widget> screens = const [
final List<Widget> screens = const [
OfficeFurnitureListScreen(),
CartScreen(),
FavoriteScreen(),
@@ -32,7 +25,7 @@ class _HomeScreenState extends State<HomeScreen> {
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: Obx(
() {
() {
return BottomNavigationBar(
unselectedItemColor: Colors.grey,
currentIndex: controller.currentBottomNavItemIndex.value,
@@ -42,8 +35,8 @@ class _HomeScreenState extends State<HomeScreen> {
items: AppData.bottomNavigationItems
.map(
(element) => BottomNavigationBarItem(
icon: element.icon, label: element.label),
)
icon: element.icon, label: element.label),
)
.toList(),
);
},
3 changes: 1 addition & 2 deletions lib/src/view/screen/office_furniture_detail_screen.dart
Original file line number Diff line number Diff line change
@@ -15,9 +15,8 @@ import 'home_screen.dart';

class OfficeFurnitureDetailScreen extends StatelessWidget {
final Furniture furniture;
final int index;

const OfficeFurnitureDetailScreen({Key? key, required this.furniture,required this.index})
const OfficeFurnitureDetailScreen({Key? key, required this.furniture})
: super(key: key);

PreferredSizeWidget _appBar(BuildContext context) {
2 changes: 1 addition & 1 deletion lib/src/view/screen/office_furniture_list_screen.dart
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ class OfficeFurnitureListScreen extends StatelessWidget {
PageRouteBuilder(
transitionDuration: const Duration(seconds: 1),
pageBuilder: (_, __, ___) =>
OfficeFurnitureDetailScreen(furniture: furniture, index: index),
OfficeFurnitureDetailScreen(furniture: furniture),
),
);
}
12 changes: 7 additions & 5 deletions lib/src/view/widget/cart_list_view.dart
Original file line number Diff line number Diff line change
@@ -2,19 +2,21 @@ import 'package:flutter/material.dart';
import 'package:office_furniture_store/core/app_extension.dart';
import 'package:office_furniture_store/core/app_style.dart';
import '../../model/furniture.dart';
import '../screen/home_screen.dart';

class CartListView extends StatelessWidget {
const CartListView({Key? key,required this.counterButton}) : super(key: key);
const CartListView(
{Key? key, required this.counterButton, required this.furnitureItems})
: super(key: key);

final Widget Function(Furniture furniture) counterButton;
final List<Furniture> furnitureItems;

@override
Widget build(BuildContext context) {
return ListView.separated(
itemCount: controller.cartFurniture.length,
itemCount: furnitureItems.length,
itemBuilder: (_, index) {
Furniture furniture = controller.cartFurniture[index];
Furniture furniture = furnitureItems[index];
return Padding(
padding: const EdgeInsets.all(15),
child: Row(
@@ -58,7 +60,7 @@ class CartListView extends StatelessWidget {
// Spacer(),
counterButton(furniture)
],
).fadeAnimation(0.4*index),
).fadeAnimation(0.4 * index),
);
},
separatorBuilder: (BuildContext context, int index) {

0 comments on commit 20a95e4

Please sign in to comment.