wechat_camera_picker 4.3.2 copy "wechat_camera_picker: ^4.3.2" to clipboard
wechat_camera_picker: ^4.3.2 copied to clipboard

A camera picker for Flutter projects based on WeChat's UI, which is also a separate runnable extension to the wechat_assets_picker.

example/lib/main.dart

// Copyright 2019 The FlutterCandies author. All rights reserved.
// Use of this source code is governed by an Apache license that can be found
// in the LICENSE file.

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

import 'extensions/color_extension.dart';
import 'extensions/l10n_extensions.dart';
import 'l10n/gen/app_localizations.dart';
import 'pages/splash_page.dart';

const Color themeColor = Color(0xff00bc56);

/// The mock size is used for integration tests.
/// Changing this requires at least a hot-restart.
const Size? mockSize = null;

String? packageVersion;

void main() {
  runApp(const MyApp());
  SystemChrome.setSystemUIOverlayStyle(
    SystemUiOverlayStyle.dark.copyWith(statusBarColor: Colors.transparent),
  );
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      onGenerateTitle: (BuildContext context) => context.l10n.appTitle,
      theme: ThemeData(
        brightness: Brightness.light,
        primarySwatch: themeColor.swatch,
        textSelectionTheme: const TextSelectionThemeData(
          cursorColor: themeColor,
        ),
      ),
      darkTheme: ThemeData(
        brightness: Brightness.dark,
        primarySwatch: themeColor.swatch,
        textSelectionTheme: const TextSelectionThemeData(
          cursorColor: themeColor,
        ),
      ),
      home: const SplashPage(),
      localizationsDelegates: AppLocalizations.localizationsDelegates,
      supportedLocales: AppLocalizations.supportedLocales,
      builder: (context, child) {
        if (mockSize == null) {
          return child!;
        }
        final mq = MediaQuery.of(context).copyWith(size: mockSize);
        return MediaQuery(
          data: mq,
          child: Align(
            alignment: Alignment.topCenter,
            child: SizedBox.fromSize(size: mockSize, child: child),
          ),
        );
      },
    );
  }
}