katana_picker 1.2.0 copy "katana_picker: ^1.2.0" to clipboard
katana_picker: ^1.2.0 copied to clipboard

Base package for retrieving files such as images and videos from terminal storage, cameras, etc.

example/lib/main.dart

import 'dart:io';

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

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

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

  @override
  Widget build(BuildContext context) {
    return PickerAdapterScope(
      adapter: const FilePickerAdapter(),
      child: MaterialApp(
        home: const PickerPage(),
        title: "Flutter Demo",
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
      ),
    );
  }
}

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

  @override
  State<StatefulWidget> createState() => PickerPageState();
}

class PickerPageState extends State<PickerPage> {
  final picker = Picker();
  PickerValue? _value;

  @override
  void initState() {
    super.initState();
    picker.addListener(_handledOnUpdate);
  }

  void _handledOnUpdate() {
    setState(() {});
  }

  @override
  void dispose() {
    super.dispose();
    picker.removeListener(_handledOnUpdate);
    picker.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("App Demo")),
      body: Center(
        child: _value == null
            ? const SizedBox.shrink()
            : Image.file(
                File(_value!.path!),
                fit: BoxFit.cover,
              ),
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: () async {
          _value = await picker.pickSingle();
        },
        label: const Text("Pick"),
        icon: const Icon(Icons.add_a_photo),
      ),
    );
  }
}
0
likes
110
pub points
0%
popularity

Publisher

unverified uploader

Base package for retrieving files such as images and videos from terminal storage, cameras, etc.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

file_picker, flutter, katana

More

Packages that depend on katana_picker