wechat_assets_picker 9.3.3 wechat_assets_picker: ^9.3.3 copied to clipboard
An image picker (also with videos and audio) for Flutter projects based on WeChat's UI, with full support for customization.
// 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 'package:wechat_assets_picker/wechat_assets_picker.dart';
import 'package:wechat_assets_picker_demo/l10n/gen/app_localizations.dart';
import 'constants/extensions.dart';
import 'pages/splash_page.dart';
const Color themeColor = Color(0xff00bc56);
String? packageVersion;
void main() {
runApp(const MyApp());
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle.dark.copyWith(statusBarColor: Colors.transparent),
);
AssetPicker.registerObserve();
// Enables logging with the photo_manager.
PhotoManager.setLog(true);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
ThemeData _buildTheme(Brightness brightness) {
return ThemeData(
brightness: brightness,
primarySwatch: themeColor.swatch,
textSelectionTheme: const TextSelectionThemeData(cursorColor: themeColor),
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
onGenerateTitle: (context) => context.l10n.appTitle,
theme: _buildTheme(Brightness.light),
darkTheme: _buildTheme(Brightness.dark),
home: const SplashPage(),
builder: (BuildContext c, Widget? w) {
return ScrollConfiguration(
behavior: const NoGlowScrollBehavior(),
child: w!,
);
},
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
);
}
}
class NoGlowScrollBehavior extends ScrollBehavior {
const NoGlowScrollBehavior();
@override
Widget buildOverscrollIndicator(
BuildContext context,
Widget child,
ScrollableDetails details,
) =>
child;
}