fluttermoji 1.0.2 fluttermoji: ^1.0.2 copied to clipboard
A light-weight and highly customizable SVG avatar library for Flutter apps. Provides a Customizer Widget, CircleAvatar and other utility functions that are ready-to-use.
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:fluttermoji/fluttermoji.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fluttermoji Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData.light(),
// darkTheme: ThemeData.dark(),
home: MyHomePage(title: 'Fluttermoji'),
);
}
}
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!),
centerTitle: true,
),
body: ListView(
physics: BouncingScrollPhysics(),
children: <Widget>[
SizedBox(
height: 25,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
"Use your Fluttermoji anywhere\nwith the below widget",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20),
textAlign: TextAlign.center,
),
),
SizedBox(
height: 25,
),
FluttermojiCircleAvatar(
backgroundColor: Colors.grey[200],
radius: 100,
),
SizedBox(
height: 25,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"and create your own page to customize them using our widgets",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20),
textAlign: TextAlign.center,
),
),
SizedBox(
height: 50,
),
Row(
children: [
Spacer(flex: 2),
Expanded(
flex: 3,
child: Container(
height: 35,
child: ElevatedButton.icon(
icon: Icon(Icons.edit),
label: Text("Customize"),
onPressed: () => Navigator.push(context,
new MaterialPageRoute(builder: (context) => NewPage())),
),
),
),
Spacer(flex: 2),
],
),
SizedBox(
height: 100,
),
],
),
);
}
}
class NewPage extends StatelessWidget {
const NewPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
var _width = MediaQuery.of(context).size.width;
return Scaffold(
appBar: AppBar(),
body: Center(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 30),
child: FluttermojiCircleAvatar(
radius: 100,
backgroundColor: Colors.grey[200],
),
),
SizedBox(
width: min(600, _width * 0.85),
child: Row(
children: [
Text(
"Customize:",
style: Theme.of(context).textTheme.titleLarge,
),
Spacer(),
FluttermojiSaveWidget(),
],
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 30),
child: FluttermojiCustomizer(
scaffoldWidth: min(600, _width * 0.85),
autosave: false,
theme: FluttermojiThemeData(
boxDecoration: BoxDecoration(boxShadow: [BoxShadow()])),
),
),
],
),
),
),
);
}
}