creating instagram clone

 import 'package:flutter/material.dart';


class InstagramClone extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: Text('Instagram'),
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header
Container(
padding: EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(Icons.camera_alt),
Text(
'Instagram',
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
Icon(Icons.send),
],
),
),

// Stories
Container(
height: 100.0,
padding: EdgeInsets.symmetric(vertical: 8.0),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 10,
itemBuilder: (context, index) {
return Container(
width: 80.0,
margin: EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
children: [
CircleAvatar(
radius: 30.0,
// Display user profile picture
),
SizedBox(height: 4.0),
Text(
'Username',
overflow: TextOverflow.ellipsis,
),
],
),
);
},
),
),

// Post List
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: 10,
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.symmetric(vertical: 8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// User Info
Row(
children: [
CircleAvatar(
radius: 16.0,
// Display user profile picture
),
SizedBox(width: 8.0),
Text(
'Username',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
],
),

// Post Image
Container(
margin: EdgeInsets.symmetric(vertical: 8.0),
height: 200.0,
width: double.infinity,
color: Colors.grey,
// Display post image
),

// Post Actions
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
IconButton(
onPressed: () {
// Handle like button tap
},
icon: Icon(Icons.favorite_border),
),
IconButton(
onPressed: () {
// Handle comment button tap
},
icon: Icon(Icons.chat_bubble_outline),
),
IconButton(
onPressed: () {
// Handle share button tap
},
icon: Icon(Icons.share),
),
],
),
IconButton(
onPressed: () {
// Handle bookmark button tap
},
icon: Icon(Icons.bookmark_border),
),
],
),

// Like Count
Container(
margin: EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
'Liked by 1,000 people',
style: TextStyle(fontWeight: FontWeight.bold),
),
),

// Caption
Container(
margin: EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
'This is the caption of the post.',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
],
),
);
},
),
],
),
),
),
);
}
}

Comments

Popular posts from this blog

swapping the alternate values in given array's element ! 17/11/2022

Learning stage | c++ programs

c++ basic question