thorvg 1.0.0-pre.4 copy "thorvg: ^1.0.0-pre.4" to clipboard
thorvg: ^1.0.0-pre.4 copied to clipboard

ThorVG Flutter Runtime

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    const textStyle = TextStyle(fontSize: 24);
    const spacerSmall = SizedBox(height: 10);

    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.white,
        appBar: AppBar(
          title: const Text('ThorVG Flutter'),
        ),
        body: SingleChildScrollView(
          child: Container(
            margin: const EdgeInsets.only(top: 100),
            padding: const EdgeInsets.all(10),
            child: Column(
              children: [
                Lottie.network(
                  'https://lottie.host/6d7dd6e2-ab92-4e98-826a-2f8430768886/NGnHQ6brWA.json',
                  width: 300,
                  height: 300,
                ),
                const Text(
                  'Lottie animation is running in a native API powered by ThorVG.',
                  style: textStyle,
                  textAlign: TextAlign.center,
                ),
                spacerSmall,
              ],
            ),
          ),
        ),
      ),
    );
  }
}