Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Learning how to use NetworkImage() to load images
- import 'package:flutter/material.dart';
- void main() => runApp(MaterialApp(
- home: Home(),
- ));
- //StatelessWidget => cannot change over time -> its constant
- //why @override ? => beacuse StatelessWidget has it's own build function, as we want to write out own build func, we override it
- class Home extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(
- 'App bar',
- style: TextStyle(color: Colors.white),
- ),
- centerTitle: true,
- backgroundColor: Colors.red,
- ),
- body: Center(
- child: Image(
- image : NetworkImage('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT5fekdY7QzAbN4Dvy_xIJHUbiyBNXn3qvUIw&usqp=CAU'),
- ),
- ),
- floatingActionButton: FloatingActionButton(
- child: Text('click me'),
- onPressed: null,
- backgroundColor: Colors.red,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement