narimetisaigopi

my_grid_view.dart

Nov 27th, 2020
1,018
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2. import 'package:ultra_washtex/view/myweb_view.dart';
  3.  
  4. class MyHomeGridView extends StatelessWidget {
  5.   List<String> titles = [
  6.     "Google",
  7.     "FB",
  8.     "Twitter",
  9.     "Insta",
  10.     "Amazon",
  11.     "Flipkart",
  12.     "Google",
  13.     "FB",
  14.     "Twitter",
  15.     "Insta",
  16.     "Amazon",
  17.     "Flipkart"
  18.   ];
  19.   List<String> images = [
  20.     "cart.png",
  21.     "flipkart.jpeg",
  22.     "logo.png",
  23.     "more.png",
  24.     "home.png",
  25.     "more.png",
  26.     "cart.png",
  27.     "flipkart.jpeg",
  28.     "logo.png",
  29.     "more.png",
  30.     "home.png",
  31.     "more.png",
  32.   ];
  33.   List<String> urls = [
  34.     "https://pub.dev/packages/webview_flutter",
  35.     "https://pub.dev/packages/webview_flutter",
  36.     "https://pub.dev/packages/webview_flutter",
  37.     "https://pub.dev/packages/webview_flutter",
  38.     "https://pub.dev/packages/webview_flutter",
  39.     "https://pub.dev/packages/webview_flutter",
  40.     "https://pub.dev/packages/webview_flutter",
  41.     "https://pub.dev/packages/webview_flutter",
  42.     "https://pub.dev/packages/webview_flutter",
  43.     "https://pub.dev/packages/webview_flutter",
  44.     "https://pub.dev/packages/webview_flutter",
  45.     "https://pub.dev/packages/webview_flutter",
  46.   ];
  47.   @override
  48.   Widget build(BuildContext context) {
  49.     return Scaffold(
  50.       appBar: AppBar(),
  51.       body: GridView.builder(
  52.           itemCount: titles.length,
  53.           gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  54.               crossAxisCount:
  55.                   (Orientation.portrait == MediaQuery.of(context).orientation)
  56.                       ? 3
  57.                       : 2),
  58.           itemBuilder: (context, index) {
  59.             return Padding(
  60.               padding: const EdgeInsets.all(8.0),
  61.               child: new InkResponse(
  62.                 onTap: () async {
  63.                   Navigator.of(context).push(MaterialPageRoute(
  64.                       builder: (cc) => MyWebView(urls[index])));
  65.                 },
  66.                 child: Column(
  67.                   children: [
  68.                     new Container(
  69.                       width: 80,
  70.                       height: 80,
  71.                       decoration: new BoxDecoration(
  72.                         color: Colors.green,
  73.                         shape: BoxShape.circle,
  74.                         border: Border.all(
  75.                           color: Colors.red,
  76.                           width: 2,
  77.                         ),
  78.                       ),
  79.                       alignment: Alignment.center,
  80.                       child: new Container(
  81.                         width: 50.0,
  82.                         height: 50.0,
  83.                         decoration: new BoxDecoration(
  84.                           shape: BoxShape.circle,
  85.                           color: Colors.white,
  86.                           border: Border.all(
  87.                             color: Colors.white,
  88.                             width: 2,
  89.                           ),
  90.                           image: new DecorationImage(
  91.                             fit: BoxFit.fill,
  92.                             image: AssetImage(
  93.                               "assets/images/" + images[index],
  94.                             ),
  95.                           ),
  96.                         ),
  97.                       ),
  98.                     ),
  99.                     SizedBox(
  100.                       height: 5,
  101.                     ),
  102.                     Text(titles[index])
  103.                   ],
  104.                 ),
  105.               ),
  106.             );
  107.           }),
  108.     );
  109.   }
  110. }
  111.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×