Created
May 3, 2023 17:12
-
-
Save rubywai/f4dbaabbe3c97db33f55854c5d811d84 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //debug release profile | |
| //assets file binary network | |
| //container | |
| // Material , Cupertino | |
| //Stateless .Stateful | |
| //row column wrap container stack | |
| //listview gridview | |
| import 'package:flutter/material.dart'; | |
| //asset file network memory | |
| void main() { | |
| runApp(const MaterialApp(debugShowCheckedModeBanner: false, home: Home())); | |
| } | |
| //List ListView.builder() ListView.separeate() | |
| class Home extends StatelessWidget { | |
| const Home({Key? key}) : super(key: key); | |
| //positioned | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| title: const Text('Stack Lesson'), | |
| ), | |
| body: GridView.builder( | |
| padding: EdgeInsets.all(8), | |
| itemCount: 1000, | |
| gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( | |
| crossAxisCount: 3, | |
| mainAxisSpacing: 8, | |
| crossAxisSpacing: 8, | |
| childAspectRatio: 2/3 | |
| ), | |
| itemBuilder: (BuildContext context, int index) { | |
| return Container( | |
| padding: const EdgeInsets.all(3), | |
| color: Colors.grey, | |
| child: Column( | |
| mainAxisAlignment: MainAxisAlignment.center, | |
| children: [ | |
| Text('Person $index'), | |
| const Divider(color: Colors.white,), | |
| const Icon(Icons.person), | |
| const Divider(color: Colors.white,), | |
| ElevatedButton(onPressed: (){ | |
| _showSnackBar(context, "You followed Person $index"); | |
| }, child: const Text('Follow')) | |
| ], | |
| ), | |
| ); | |
| }, | |
| ) | |
| ); | |
| } | |
| Widget _profile(BuildContext context,int position){ | |
| debugPrint('ui is building $position'); | |
| return Column( | |
| children: [ | |
| ListTile( | |
| onTap: (){ | |
| _showSnackBar(context, 'Person $position'); | |
| }, | |
| leading: const Icon(Icons.person), | |
| title: Text('Person $position'), | |
| subtitle: Text('Address $position'), | |
| trailing: (position %2 == 0) ? const Icon(Icons.phone) : const Icon(Icons.email), | |
| ), | |
| const Divider(height: 4,thickness: 3,), | |
| ], | |
| ); | |
| } | |
| void _showSnackBar(BuildContext context,String text){ | |
| ScaffoldMessenger.of(context) | |
| .showSnackBar(SnackBar(content: Text(text))); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment