Home > Software engineering >  I am trying to create circle avatar in Flutter like:
I am trying to create circle avatar in Flutter like:

Time:10-02

import 'package:flutter/material.dart';

class ImagenesPage extends StatelessWidget { const ImagenesPage({Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Imágenes'), ), body: SingleChildScrollView( child: Container( padding: const EdgeInsets.all(10.0), child: Column( children: [ Image.asset('assets/images/wallpaper.png'), const Padding(padding: EdgeInsets.fromLTRB(0, 10, 0, 0)), Image.network( 'https://previews.123rf.com/images/cc0collection/cc0collection2205/cc0collection220540918/186116605-oranges,-fruits,-citrus,-vitamins,-juicy,-food,-green,-leaf,-harvest,-fram,-wet,-water,-drops.jpg?fj=1'), ], ), ), ), ); } }

CodePudding user response:

This is how you can add an circle avater:

CircleAvatar(
radius: 20,
child: ClipOval(
    child: Image.network(
      'https://previews.123rf.com/images/cc0collection/cc0collection2205/cc0collection220540918/186116605-oranges,-fruits,-citrus,-vitamins,-juicy,-food,-green,-leaf,-harvest,-fram,-wet,-water,-drops.jpg?fj=1',
        ),
    ),
),

CodePudding user response:

Try the following code:

CircleAvatar(
  backgroundImage: NetworkImage('https://previews.123rf.com/images/cc0collection/cc0collection2205/cc0collection220540918/186116605-oranges,-fruits,-citrus,-vitamins,-juicy,-food,-green,-leaf,-harvest,-fram,-wet,-water,-drops.jpg?fj=1'),
),
  • Related