alphalogy_sticker 0.0.2 alphalogy_sticker: ^0.0.2 copied to clipboard
This package is built based on Lindi Sticker
import 'dart:typed_data';
import 'package:alphalogy_sticker/alpha_sticker_controller.dart';
import 'package:alphalogy_sticker/alpha_sticker_list_widget.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Lindi Sticker Widget',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
AlphaStickerController controller =
AlphaStickerController(borderColor: Colors.white, iconColor: Colors.blue);
Uint8List? image;
@override
void initState() {
controller.addWidget(SizedBox(
height: 100,
width: 100,
child: Image.network('https://picsum.photos/200/200')));
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.orange,
title: const Text('Alphalogy Sticker Widget'),
),
body: Column(
children: [
Expanded(
child: AlphaStickerListWidget(
controller: controller,
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: Image.network('https://picsum.photos/200/300',
fit: BoxFit.cover)),
),
),
if (image != null)
Expanded(
child: Image.memory(image!),
)
],
),
floatingActionButton: FloatingActionButton(
onPressed: () async {
Widget widget = Container(
padding: const EdgeInsets.all(12),
decoration: const BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.all(Radius.circular(20))),
child: const Text(
'This is a Text',
style: TextStyle(color: Colors.white),
),
);
controller.addWidget(Text("Test"));
},
tooltip: 'Add',
child: const Icon(Icons.add),
),
);
}
}