main.dart 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'dart:io';
  2. import 'package:douyin_demo/pages/recommend_page.dart';
  3. import 'package:douyin_demo/routes.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:shared_preferences/shared_preferences.dart';
  6. void main() async {
  7. WidgetsFlutterBinding.ensureInitialized();
  8. final prefs = await SharedPreferences.getInstance();
  9. prefs.setBool("ifIOS", Platform.isIOS);
  10. prefs.setBool("ifPrd", false);
  11. prefs.setBool("ifReal_d", false);
  12. prefs.setString("urlPath_real_d", "192.168.0.8");
  13. prefs.setString("scheme_real_d", "http");
  14. prefs.setInt("ports_real_d", 5000);
  15. prefs.setString("urlPath_ios_d", "127.0.0.1");
  16. prefs.setString("scheme_ios_d", "http");
  17. prefs.setInt("ports_ios_d", 5000);
  18. prefs.setString("urlPath_and_d", "10.0.2.2");
  19. prefs.setString("scheme_and_d", "http");
  20. prefs.setInt("ports_and_d", 5000);
  21. prefs.setString("urlPath_p", "118.26.177.76");
  22. prefs.setString("scheme_p", "http");
  23. prefs.setInt("ports_p", 80);
  24. // prefs.setString("picServer", "http://www.guojio.com");
  25. runApp(MyApp());
  26. }
  27. class MyApp extends StatelessWidget {
  28. const MyApp({Key? key}) : super(key: key);
  29. @override
  30. Widget build(BuildContext context) {
  31. return MaterialApp(
  32. title: "抖音",
  33. debugShowCheckedModeBanner: false,
  34. theme: ThemeData(primaryColor: Color(0xff121319)),
  35. home: RecommendPage(
  36. selIndex: 0,
  37. ),
  38. routes: Routes.define(),
  39. // initialRoute: Routes.splash,
  40. );
  41. }
  42. }