AssetImage using

This commit is contained in:
2024-05-11 22:48:46 +03:00
parent b4092837d2
commit 57ff8a59e8
5 changed files with 28 additions and 12 deletions

View File

@@ -14,9 +14,10 @@ class GymLinkAppBar extends StatelessWidget implements PreferredSizeWidget {
title: Row( title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Padding( const Padding(
padding: const EdgeInsets.only(right: 8), padding: EdgeInsets.only(right: 8),
child: Image.asset('logo.png', width: 24, height: 24), child: Image(
image: AssetImage('assets/logo.png'), width: 24, height: 24),
), ),
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,

View File

@@ -224,8 +224,8 @@ class _BasketPageState extends State<BasketPage> {
name: item['name'], name: item['name'],
price: item['price'], price: item['price'],
id: item['id'], id: item['id'],
image: Image.asset( image: Image(
item['image'], image: AssetImage('assets/${item['image']}'),
width: 50, width: 50,
), ),
onTapPlus: () => addItem(item['id'].toString()), onTapPlus: () => addItem(item['id'].toString()),

View File

@@ -179,8 +179,8 @@ class _MainPageState extends State<MainPage> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
final product = testData[index]; final product = testData[index];
return ProductCard( return ProductCard(
imagePath: Image.asset( imagePath: Image(
product['image']!, image: AssetImage('assets/${product['image']!}'),
width: 100, width: 100,
), ),
name: product['name']!, name: product['name']!,
@@ -192,7 +192,10 @@ class _MainPageState extends State<MainPage> {
description: product['details']!, description: product['details']!,
price: product['price']!, price: product['price']!,
id: product['id']!, id: product['id']!,
image: Image.asset(product['image']!, width: 300), image: Image(
image:
AssetImage('assets/${product['image']!}'),
width: 300),
), ),
), ),
), ),

View File

@@ -89,7 +89,10 @@ class _OrderConfirmationPageState extends State<OrderConfirmationPage> {
final item = cartItems[index]; final item = cartItems[index];
return OrderConfirmItemCard( return OrderConfirmItemCard(
name: item['name'], name: item['name'],
image: Image.asset(item['image'], width: 50, height: 50), image: Image(
image: AssetImage('assets/${item['image']}'),
width: 50,
height: 50),
price: double.parse(item['price']), price: double.parse(item['price']),
count: item['count'], count: item['count'],
); );
@@ -126,7 +129,16 @@ class _OrderConfirmationPageState extends State<OrderConfirmationPage> {
), ),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
debugPrint('Order confirmed'); print('debugprint');
// if (kIsWeb) {
// Navigator.of(context).push(
// MaterialPageRoute(
// builder: (context) => const OrderPayPage(),
// ),
// );
// } else {
// debugPrint('test');
// }
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).primaryColor,

View File

@@ -60,8 +60,8 @@ class HistoryPage extends StatelessWidget {
id: item['id']!, id: item['id']!,
cost: item['price']!, cost: item['price']!,
date: item['date']!, date: item['date']!,
image: Image.asset( image: Image(
item['image']!, image: AssetImage('assets/${item['image']!}'),
width: 50, width: 50,
), ),
status: OrderStatus.completed, status: OrderStatus.completed,