avatars 1.0.2 copy "avatars: ^1.0.2" to clipboard
avatars: ^1.0.2 copied to clipboard

outdated

An avatar widget that uses the best available data source among those provided (social images, gravatar, name initials, custom)

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:avatars/avatars.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Avatars Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Avatars Demo'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Avatar(
              sources: [
                GitHubSource('luckyseven'),
                InstagramSource(
                    'alberto.fecchi'), // Fallback if GitHubSource is not available
              ],
              name:
                  'Alberto Fecchi', // Fallback if no image source is available
            ),
            Avatar(
              elevation: 3,
              shape: AvatarShape.roundedSquare(100, 10),
              name: 'Alberto Fecchi', // Uses name initials (up to two)
            ),
          ],
        ),
      ),
    );
  }
}
80
likes
40
points
3.22k
downloads

Publisher

verified publisheralbertofecchi.com

Weekly Downloads

An avatar widget that uses the best available data source among those provided (social images, gravatar, name initials, custom)

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

crypto, flutter, flutter_cache_manager

More

Packages that depend on avatars