Jaagdish47

//6.Designing The Mobile app to implement theming and styling

Nov 24th, 2024
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 3.17 KB | Source Code | 0 0
  1. //6.Designing The Mobile app to implement theming and styling
  2. import 'package:flutter/material.dart';
  3.  
  4. void main() {
  5.   runApp(MyApp());
  6. }
  7.  
  8. class MyApp extends StatelessWidget {
  9.   @override
  10.   Widget build(BuildContext context) {
  11.     return MaterialApp(
  12.       title: 'Network Image',
  13.       theme: ThemeData(
  14.         primarySwatch: Colors.blue,
  15.       ),
  16.       home: MyHomePage(),
  17.       debugShowCheckedModeBanner: false,
  18.     );
  19.   }
  20. }
  21. class MyHomePage extends StatefulWidget {
  22.   @override
  23.   _MyHomePageState createState() => _MyHomePageState();
  24. }
  25.  
  26. class _MyHomePageState extends State<MyHomePage> {
  27.   @override
  28.   Widget build(BuildContext context) {
  29.     return Scaffold(
  30.       / Design of the application
  31.       appBar: AppBar(
  32.         title: const Text("GeeksforGeeks"),
  33.         backgroundColor: Colors.green,
  34.       ),
  35.       body: Padding(
  36.         padding: const EdgeInsets.all(8.0),
  37.         child: ListView(
  38.           children: <Widget>[
  39.             Padding(
  40.               padding: const EdgeInsets.all(8.0),
  41.               // Image.network(src)
  42.               child: Image.network(
  43.                 "https://images.unsplash.com/photo-1584395630820-26d8c2ab3d8e",
  44.                 loadingBuilder: (context, child, loadingProgress) {
  45.                   if (loadingProgress == null) {
  46.                     return child;
  47.                   } else {
  48.                     return const Center(child: CircularProgressIndicator());
  49.                   }
  50.                 },
  51.                 errorBuilder: (context, error, stackTrace) {
  52.                   return const Center(
  53.                     child: Text("Failed to load image"),
  54.                   );
  55.                 },
  56.               ),
  57.             ),
  58.             Padding(
  59.               padding: const EdgeInsets.all(8.0),
  60.               child: Image.network(
  61.                 "https://images.unsplash.com/photo-1511765224389-37f0e77cf0eb",
  62.                 loadingBuilder: (context, child, loadingProgress) {
  63.                   if (loadingProgress == null) {
  64.                     return child;
  65.                   } else {
  66.                     return const Center(child: CircularProgressIndicator());
  67.                   }
  68.                 },
  69.                 errorBuilder: (context, error, stackTrace) {
  70.                   return const Center(
  71.                     child: Text("Failed to load image"),
  72.                   );
  73.                 },
  74.               ),
  75.             ),
  76.             Padding(
  77.               padding: const EdgeInsets.all(8.0),
  78.               child: Image.network(
  79.                 "https://images.unsplash.com/photo-1593642633279-1796119d5482",
  80.                 loadingBuilder: (context, child, loadingProgress) {
  81.                   if (loadingProgress == null) {
  82.                     return child;
  83.                   } else {
  84.                     return const Center(child: CircularProgressIndicator());
  85.                   }
  86.                 },
  87.                 errorBuilder: (context, error, stackTrace) {
  88.                   return const Center(
  89.                     child: Text("Failed to load image"),
  90.                   );
  91.                 },
  92.               ),
  93.             ),
  94.           ],
  95.         ),
  96.       ),
  97.     );
  98.   }
  99. }
  100.  
Advertisement
Add Comment
Please, Sign In to add comment