pencil_kit 0.0.2+1 pencil_kit: ^0.0.2+1 copied to clipboard
A Flutter plugin that provides a iOS PencilKit widget on iOS.
import 'package:flutter/material.dart';
import 'package:pencil_kit/pencil_kit.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late final PencilKitController controller;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('PencilKit Example'),
actions: [
IconButton(
icon: const Icon(Icons.palette),
onPressed: () => controller.show(),
),
IconButton(
icon: const Icon(Icons.close),
onPressed: () => controller.hide(),
),
IconButton(
icon: const Icon(Icons.undo),
onPressed: () => controller.undo(),
),
IconButton(
icon: const Icon(Icons.redo),
onPressed: () => controller.redo(),
),
IconButton(
icon: const Icon(Icons.refresh),
onPressed: () => controller.clear(),
),
],
),
body: Container(
color: Colors.blueAccent.withOpacity(0.2),
child: PencilKit(
onPencilKitViewCreated: (controller) => this.controller = controller,
),
),
),
);
}
}