voxa_beauty 0.4.7
voxa_beauty: ^0.4.7 copied to clipboard
Real-time beauty for VoxaRTC on the camera capture path — smoothing and tone for free; colour filters, retouch, makeup looks, stickers and a cloud catalog with a Beauty key.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:voxa_beauty/voxa_beauty.dart';
import 'package:voxa_rtc_engine/voxa_rtc_engine.dart';
/// The smallest possible integration: camera on, beauty on, one slider.
/// The full demo — filters, looks, stickers, catalog — is
/// voxa_rtc_engine/example/lib/beauty_probe.dart.
const appId = 'YOUR_APP_ID';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MaterialApp(home: Demo()));
}
class Demo extends StatefulWidget {
const Demo({super.key});
@override
State<Demo> createState() => _DemoState();
}
class _DemoState extends State<Demo> {
late final RtcEngine _engine = createAgoraRtcEngine();
late final VoxaBeauty _beauty = VoxaBeauty(_engine);
VideoViewController? _preview;
double _smooth = 0.5;
@override
void initState() {
super.initState();
_start();
}
Future<void> _start() async {
await _engine.initialize(const RtcEngineContext(appId: appId));
await _engine.enableVideo();
await _engine.startPreview();
await _beauty.enable();
await _beauty.setRetouch(smooth: _smooth, white: 0.3);
setState(() => _preview = VideoViewController(rtcEngine: _engine, canvas: const VideoCanvas(uid: 0)));
}
@override
void dispose() {
_beauty.disable();
_engine.release();
super.dispose();
}
@override
Widget build(BuildContext context) {
final preview = _preview;
return Scaffold(
backgroundColor: Colors.black,
body: Stack(children: [
if (preview != null) Positioned.fill(child: AgoraVideoView(controller: preview)),
Positioned(
left: 16, right: 16, bottom: 32,
child: Slider(
value: _smooth,
onChanged: (v) {
setState(() => _smooth = v);
_beauty.setRetouch(smooth: v);
},
),
),
]),
);
}
}