Initial commit of Flutter project
This commit is contained in:
@@ -1,52 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import 'package:glowwheels/models/shop_profile_model.dart';
|
||||
|
||||
class ProfileHeader extends StatelessWidget {
|
||||
const ProfileHeader({super.key});
|
||||
final ShopProfileModel? shopProfile;
|
||||
|
||||
const ProfileHeader({super.key, this.shopProfile});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (shopProfile == null) {
|
||||
// Show skeleton loader
|
||||
return _buildSkeleton(context);
|
||||
}
|
||||
|
||||
final name = shopProfile!.name;
|
||||
final phone = shopProfile!.phone;
|
||||
final email = shopProfile!.email;
|
||||
final imageUrl = (shopProfile!.images.isNotEmpty) ? shopProfile!.images.first : null;
|
||||
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
// Circular Profile Image
|
||||
CircleAvatar(
|
||||
radius: 40,
|
||||
backgroundImage: AssetImage('assets/images/shop_image.jpg'), // Replace with your asset
|
||||
backgroundImage: imageUrl != null
|
||||
? NetworkImage(imageUrl)
|
||||
: const AssetImage('assets/images/shop_image.jpg') as ImageProvider,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
// Details Column
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const [
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
ImageIcon(AssetImage("assets/icon/account_icon.png")),
|
||||
SizedBox(width: 8),
|
||||
const ImageIcon(AssetImage("assets/icon/account_icon.png")),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Omkara Car Wash Center',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
||||
name,
|
||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
ImageIcon(AssetImage("assets/icon/contact_icon.png")),
|
||||
SizedBox(width: 8),
|
||||
Text('+91 9999988888'),
|
||||
const ImageIcon(AssetImage("assets/icon/contact_icon.png")),
|
||||
const SizedBox(width: 8),
|
||||
Text(phone),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
ImageIcon(AssetImage("assets/icon/Message_icon.png")),
|
||||
SizedBox(width: 8),
|
||||
Expanded(child: Text('loremipsum@gmail.com')),
|
||||
const ImageIcon(AssetImage("assets/icon/Message_icon.png")),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(child: Text(email)),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -56,4 +70,38 @@ class ProfileHeader extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSkeleton(BuildContext context) {
|
||||
final baseColor = Colors.grey[300]!;
|
||||
final highlightColor = Colors.grey[100]!;
|
||||
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Shimmer.fromColors(
|
||||
baseColor: baseColor,
|
||||
highlightColor: highlightColor,
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(color: baseColor, shape: BoxShape.circle),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(height: 20, color: baseColor, margin: const EdgeInsets.only(bottom: 12)),
|
||||
Container(height: 16, width: 150, color: baseColor, margin: const EdgeInsets.only(bottom: 12)),
|
||||
Container(height: 16, width: 200, color: baseColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user