main.dart 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. try{
  11. WidgetsFlutterBinding.ensureInitialized();
  12. SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.transparent,statusBarIconBrightness: Brightness.dark,),);
  13. SystemChrome.setPreferredOrientations([
  14. DeviceOrientation.portraitUp,
  15. DeviceOrientation.portraitDown
  16. ]);
  17. _initFluwx();
  18. FlutterAlipay.setIosUrlSchema("flutteralipaydemo");
  19. runApp(MyApp());
  20. }catch(e){
  21. print('===============================$e===============================');
  22. }
  23. }
  24. class MyApp extends StatelessWidget {
  25. @override
  26. Widget build(BuildContext context) {
  27. return MaterialApp(
  28. debugShowCheckedModeBanner: false,
  29. theme: ThemeData(
  30. primaryColor: Color(0xFF0088FF),
  31. visualDensity: VisualDensity.adaptivePlatformDensity,
  32. backgroundColor: Color(0xFFF5F6F8),
  33. ),
  34. localeListResolutionCallback:
  35. (List<Locale> locales, Iterable<Locale> supportedLocales) {
  36. return Locale('zh');
  37. },
  38. localeResolutionCallback:
  39. (Locale locale, Iterable<Locale> supportedLocales) {
  40. return Locale('zh');
  41. },
  42. localizationsDelegates: [
  43. ZhCupertinoLocalizations.delegate,
  44. GlobalMaterialLocalizations.delegate,
  45. GlobalWidgetsLocalizations.delegate,
  46. GlobalCupertinoLocalizations.delegate,
  47. ],
  48. supportedLocales: [
  49. const Locale('zh', 'CH'),
  50. const Locale('en', 'US'),
  51. ],
  52. home: MyHomePage()
  53. );
  54. }
  55. }
  56. class MyHomePage extends StatelessWidget {
  57. @override
  58. Widget build(BuildContext context) {
  59. ScreenUtil.init(context,designSize: Size(750, 1624),allowFontScaling: false);
  60. return YSTabbar();
  61. }
  62. }
  63. _initFluwx() async {
  64. await registerWxApi(
  65. appId: "wxd930ea5d5a258f4f",
  66. doOnAndroid: true,
  67. doOnIOS: true,
  68. universalLink: "https://your.univerallink.com/link/");
  69. var result = await isWeChatInstalled;
  70. print("is installed $result");
  71. }