fh_assets_picker 3.0.4 copy "fh_assets_picker: ^3.0.4" to clipboard
fh_assets_picker: ^3.0.4 copied to clipboard

An image (and videos) picker similar with Instagram, supports multi picking, crop and aspect ratio.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:insta_assets_picker_demo/pages/stateless_pickers.dart';
import 'package:insta_assets_picker_demo/pages/camera/camera_picker.dart';
import 'package:insta_assets_picker_demo/pages/camera/wechat_camera_picker.dart';
import 'package:insta_assets_picker_demo/pages/restorable_picker.dart';
import 'package:insta_assets_picker_demo/post_provider.dart';
import 'package:insta_assets_picker_demo/widgets/insta_picker_interface.dart';
import 'package:insta_assets_picker_demo/widgets/post.dart';
import 'package:provider/provider.dart';

const kDefaultColor = Colors.deepPurple;

void main() => runApp(
      ChangeNotifierProvider(
        create: (context) => PostProvider(),
        child: const MyApp(),
      ),
    );

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Insta Assets Picker Demo',
      // update to change the main theme of app + picker
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: kDefaultColor,
          brightness: Brightness.dark,
        ),
        cardTheme: const CardTheme(
          elevation: 2,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(8)),
          ),
        ),
        listTileTheme: const ListTileThemeData(
          enableFeedback: true,
          contentPadding: EdgeInsets.all(16),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(8)),
          ),
          titleTextStyle: TextStyle(fontWeight: FontWeight.w600),
          leadingAndTrailingTextStyle: TextStyle(fontSize: 24),
        ),
      ),
      home: const PickersScreen(),
      localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
        GlobalWidgetsLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [Locale('en')],
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final List<InstaPickerInterface> pickers = [
      const SinglePicker(),
      const MultiplePicker(),
      const RestorablePicker(),
      // const CameraPicker(),
      // const WeChatCameraPicker(),
    ];

    return Scaffold(
      appBar: AppBar(
        title: const Text('Insta pickers'),
        actions: [
          IconButton(
            onPressed: () => Navigator.of(context).push(
              MaterialPageRoute(builder: (context) => const PostsPage()),
            ),
            icon: Icon(Icons.feed, semanticLabel: 'Feed'),
          )
        ],
      ),
      body: ListView.separated(
        padding: const EdgeInsets.all(16),
        itemBuilder: (BuildContext context, int index) {
          final PickerDescription description = pickers[index].description;

          return Card(
            child: ListTile(
              leading: Text(description.icon),
              title: Text(description.label),
              subtitle: description.description != null
                  ? Text(description.description!)
                  : null,
              trailing: const Icon(Icons.chevron_right_rounded),
              onTap: () => Navigator.of(context).push(
                MaterialPageRoute(builder: (context) => pickers[index]),
              ),
            ),
          );
        },
        separatorBuilder: (_, __) => const SizedBox(height: 4),
        itemCount: pickers.length,
      ),
    );
  }
}
1
likes
140
points
55
downloads
screenshot

Publisher

unverified uploader

Weekly Downloads

An image (and videos) picker similar with Instagram, supports multi picking, crop and aspect ratio.

Repository (GitHub)
View/report issues

Topics

#picker #crop #image #video #instagram

Documentation

API reference

License

MIT (license)

Dependencies

extended_image, flutter, fraction, insta_assets_crop, photo_manager, provider, video_player, wechat_assets_picker, wechat_picker_library

More

Packages that depend on fh_assets_picker