Created
May 18, 2024 17:52
-
-
Save moisb/8793144b01c89a62f4b7d9e5edad081c to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
theme: ThemeData( | |
useMaterial3: true, | |
primarySwatch: Colors.blue, | |
), | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return DefaultTabController( | |
length: 4, | |
child: Scaffold( | |
appBar: AppBar( | |
backgroundColor: Colors.white, | |
title: Text( | |
'Smartphone & Tablets', | |
style: TextStyle(color: Colors.black), | |
), | |
bottom: TabBar( | |
indicatorColor: Colors.blue, | |
labelColor: Colors.blue, | |
unselectedLabelColor: Colors.grey, | |
tabs: [ | |
Tab(text: 'All'), | |
Tab(text: 'Smartphone'), | |
Tab(text: 'Tablet'), | |
Tab(text: 'Accessory'), | |
], | |
), | |
actions: [ | |
IconButton( | |
icon: Icon(Icons.search, color: Colors.black), | |
onPressed: () {}, | |
), | |
IconButton( | |
icon: Icon(Icons.shopping_cart, color: Colors.black), | |
onPressed: () {}, | |
), | |
], | |
), | |
body: TabBarView( | |
children: [ | |
_buildProductList(), | |
_buildProductList(), | |
_buildProductList(), | |
_buildProductList(), | |
], | |
), | |
), | |
); | |
} | |
Widget _buildProductList() { | |
return ListView.builder( | |
itemCount: 15, | |
itemBuilder: (context, index) { | |
return Card( | |
child: ListTile( | |
leading: Image.network( | |
'https://placehold.co/40x40?description=Product%20Thumbnail', | |
width: 40, | |
height: 40, | |
), | |
title: Text('Product Name $index'), | |
subtitle: Text('\$${(index + 1) * 10}.00'), | |
trailing: IconButton( | |
icon: Icon(Icons.add_shopping_cart), | |
onPressed: () {}, | |
), | |
), | |
); | |
}, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment