rive_mobile 0.0.1 copy "rive_mobile: ^0.0.1" to clipboard
rive_mobile: ^0.0.1 copied to clipboard

A wrapper for the Rive mobile native runtime for Flutter.

example/lib/main.dart

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

void main() => runApp(const MaterialApp(home: ExampleApp()));

class ExampleApp extends StatefulWidget {
  const ExampleApp({Key? key}) : super(key: key);

  @override
  State<ExampleApp> createState() => _ExampleAppState();
}

class _ExampleAppState extends State<ExampleApp> {
  late final TextEditingController _assetPathController;

  String assetPath = 'assets/coyote.riv';

  @override
  void initState() {
    _assetPathController = TextEditingController(text: 'assets/vehicles.riv');
    super.initState();
  }

  @override
  void dispose() {
    _assetPathController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Rive example')),
      body: Column(
        children: [
          TextFormField(
            controller: _assetPathController,
          ),
          ElevatedButton(
            onPressed: () => setState(() {
              assetPath = _assetPathController.text;
            }),
            child: const Text('Load Rive asset'),
          ),
          SizedBox(
            height: 200,
            width: 300,
            child: RiveAnimation.asset(
              assetPath,
              fit: BoxFit.fill,
            ),
          ),
          SizedBox(
            height: 200,
            width: 300,
            child: RiveAnimation.asset(
              assetPath,
              fit: BoxFit.fitHeight,
            ),
          ),
        ],
      ),
    );
  }
}
0
likes
150
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A wrapper for the Rive mobile native runtime for Flutter.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on rive_mobile