main.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_alipay/flutter_alipay.dart';
  4. import 'package:flutter_screenutil/screenutil.dart';
  5. import 'package:fluwx/fluwx.dart';
  6. import 'package:flutter_localizations/flutter_localizations.dart';
  7. import 'code/YSTabbar.dart';
  8. import 'tools/YSLocalizationsDelegate.dart';
  9. void main() {
  10. WidgetsFlutterBinding.ensureInitialized();
  11. SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.transparent,statusBarIconBrightness: Brightness.dark,),);
  12. SystemChrome.setPreferredOrientations([
  13. DeviceOrientation.portraitUp,
  14. DeviceOrientation.portraitDown
  15. ]);
  16. _initFluwx();
  17. FlutterAlipay.setIosUrlSchema("flutteralipaydemo");
  18. runApp(MyApp());
  19. }
  20. class MyApp extends StatelessWidget {
  21. @override
  22. Widget build(BuildContext context) {
  23. return MaterialApp(
  24. debugShowCheckedModeBanner: false,
  25. theme: ThemeData(
  26. primaryColor: Color(0xFF0088FF),
  27. visualDensity: VisualDensity.adaptivePlatformDensity,
  28. backgroundColor: Color(0xFFF5F6F8),
  29. ),
  30. localeListResolutionCallback:
  31. (List<Locale> locales, Iterable<Locale> supportedLocales) {
  32. return Locale('zh');
  33. },
  34. localeResolutionCallback:
  35. (Locale locale, Iterable<Locale> supportedLocales) {
  36. return Locale('zh');
  37. },
  38. localizationsDelegates: [
  39. ZhCupertinoLocalizations.delegate,
  40. GlobalMaterialLocalizations.delegate,
  41. GlobalWidgetsLocalizations.delegate,
  42. GlobalCupertinoLocalizations.delegate,
  43. ],
  44. supportedLocales: [
  45. const Locale('zh', 'CH'),
  46. const Locale('en', 'US'),
  47. ],
  48. home: MyHomePage()
  49. );
  50. }
  51. }
  52. class MyHomePage extends StatelessWidget {
  53. @override
  54. Widget build(BuildContext context) {
  55. ScreenUtil.init(context, width: 750, height: 1624, allowFontScaling: false);
  56. return YSTabbar();
  57. }
  58. }
  59. _initFluwx() async {
  60. await registerWxApi(
  61. appId: "wxd930ea5d5a258f4f",
  62. doOnAndroid: true,
  63. doOnIOS: true,
  64. universalLink: "https://your.univerallink.com/link/");
  65. var result = await isWeChatInstalled;
  66. print("is installed $result");
  67. }