Flutter - Dart

Әлеуметтік желі - Инстаграм

main.dart

				
					import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Instagram',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: ProfilePage(),
    );
  }
}

class ProfilePage extends StatelessWidget {
  final List<String> posts = [
    'https://hi-service.kz/wp-content/uploads/2023/07/701.png',
    'https://hi-service.kz/wp-content/uploads/2023/07/701.png',
    'https://hi-service.kz/wp-content/uploads/2023/07/701.png',
    'https://hi-service.kz/wp-content/uploads/2023/07/701.png',
    'https://hi-service.kz/wp-content/uploads/2023/07/701.png',
    'https://hi-service.kz/wp-content/uploads/2023/07/701.png',
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Kuandyk.it'),
      ),
      body: Column(
        children: [
          SizedBox(height: 16),
          const CircleAvatar(
            radius: 50,
            backgroundImage: NetworkImage('https://hi-service.kz/wp-content/uploads/2023/07/ava.png'),
          ),
          SizedBox(height: 16),
          Text(
            'Қуандық Жиенқожаев',
            style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
          ),
          SizedBox(height: 8),
          Text(
            '@kuandyk.it',
            style: TextStyle(fontSize: 16),
          ),
          SizedBox(height: 16),
          const Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              Column(
                children: [
                  Text(
                    'Публикации',
                    style: TextStyle(fontSize: 20),
                  ),
                  Text(
                    '123',
                    style: TextStyle(fontSize: 18),
                  ),
                ],
              ),
              Column(
                children: [
                  Text(
                    'Подписчики',
                    style: TextStyle(fontSize: 20),
                  ),
                  Text(
                    '1 млн',
                    style: TextStyle(fontSize: 18),
                  ),
                ],
              ),
              Column(
                children: [
                  Text(
                    'Подписки',
                    style: TextStyle(fontSize: 20),
                  ),
                  Text(
                    '789',
                    style: TextStyle(fontSize: 18),
                  ),
                ],
              ),
            ],
          ),
          SizedBox(height: 16),
          ElevatedButton(
            onPressed: () {
              
            },
            child: Text('Редактировать профиль'),
          ),
          SizedBox(height: 16),
          Expanded(
            child: GridView.builder(
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 3,
                mainAxisSpacing: 8,
                crossAxisSpacing: 8,
              ),
              itemCount: posts.length,
              itemBuilder: (context, index) {
                return Image.network(
                  posts[index],
                  fit: BoxFit.cover,
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}