Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 lines
5.6 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter_dotenv/flutter_dotenv.dart';
  4. import '/database/models/my_profile.dart';
  5. import '/views/main/home.dart';
  6. import '/views/authentication/unauthenticated_landing.dart';
  7. import '/views/authentication/login.dart';
  8. import '/views/authentication/signup.dart';
  9. void main() async {
  10. await dotenv.load(fileName: '.env');
  11. // TODO: Replace this with the prod url when server is deployed
  12. MyProfile.setServerUrl(dotenv.env['SERVER_URL'] ?? 'http://localhost:8080/');
  13. runApp(const MyApp());
  14. }
  15. class MyApp extends StatelessWidget {
  16. const MyApp({Key? key}) : super(key: key);
  17. static const String _title = 'Envelope';
  18. @override
  19. Widget build(BuildContext context) {
  20. return MaterialApp(
  21. title: _title,
  22. routes: {
  23. '/home': (context) => const Home(),
  24. '/landing': (context) => const UnauthenticatedLandingWidget(),
  25. '/login': (context) => const Login(),
  26. '/signup': (context) => const Signup(),
  27. },
  28. home: const Scaffold(
  29. body: SafeArea(
  30. child: Home(),
  31. )
  32. ),
  33. theme: ThemeData(
  34. brightness: Brightness.light,
  35. primaryColor: const Color(0xff014bff),
  36. backgroundColor: Colors.grey[300],
  37. scaffoldBackgroundColor: Colors.grey.shade100,
  38. disabledColor: Colors.grey[700],
  39. hintColor: Colors.grey.shade700,
  40. colorScheme: ColorScheme(
  41. brightness: Brightness.light,
  42. primary: const Color(0xff014bff),
  43. onPrimary: Colors.white,
  44. secondary: const Color(0xff1a6dff),
  45. onSecondary: Colors.black,
  46. tertiary: const Color(0xff3490ff),
  47. onTertiary: Colors.black,
  48. error: Colors.red,
  49. onError: Colors.white,
  50. background: Colors.grey.shade300,
  51. onBackground: Colors.black,
  52. surface: Colors.grey.shade100,
  53. onSurface: Colors.black,
  54. ),
  55. appBarTheme: AppBarTheme(
  56. color: Colors.grey.shade100,
  57. foregroundColor: Colors.white,
  58. iconTheme: const IconThemeData(
  59. color: Colors.black,
  60. ),
  61. toolbarTextStyle: const TextStyle(
  62. color: Colors.black,
  63. ),
  64. systemOverlayStyle: const SystemUiOverlayStyle(
  65. statusBarColor: Colors.black,
  66. statusBarIconBrightness: Brightness.light,
  67. statusBarBrightness: Brightness.light,
  68. )
  69. ),
  70. iconTheme: const IconThemeData(color: Colors.black),
  71. inputDecorationTheme: InputDecorationTheme(
  72. filled: true,
  73. fillColor: Colors.white,
  74. labelStyle: const TextStyle(
  75. color: Colors.black,
  76. fontSize: 30,
  77. ),
  78. hintStyle: TextStyle(
  79. color: Colors.grey.shade600,
  80. ),
  81. iconColor: Colors.grey.shade500,
  82. contentPadding: const EdgeInsets.all(8),
  83. enabledBorder: OutlineInputBorder(
  84. borderRadius: BorderRadius.circular(15),
  85. borderSide: const BorderSide(
  86. color: Colors.transparent,
  87. )
  88. ),
  89. focusedBorder: OutlineInputBorder(
  90. borderRadius: BorderRadius.circular(15),
  91. borderSide: const BorderSide(
  92. color: Colors.transparent,
  93. )
  94. ),
  95. ),
  96. ),
  97. darkTheme: ThemeData(
  98. brightness: Brightness.dark,
  99. primaryColor: const Color(0xffff4a27),
  100. backgroundColor: Colors.grey.shade800,
  101. scaffoldBackgroundColor: Colors.grey[850],
  102. disabledColor: Colors.grey[400],
  103. hintColor: Colors.grey.shade400,
  104. colorScheme: ColorScheme(
  105. brightness: Brightness.dark,
  106. primary: const Color(0xffff4a27),
  107. onPrimary: Colors.white,
  108. secondary: const Color(0xffff5f3a),
  109. onSecondary: Colors.white,
  110. tertiary: const Color(0xffff7950),
  111. onTertiary: Colors.black,
  112. error: Colors.red,
  113. onError: Colors.white,
  114. background: Colors.grey.shade900,
  115. onBackground: Colors.white,
  116. surface: Colors.grey.shade700,
  117. onSurface: Colors.white,
  118. ),
  119. appBarTheme: AppBarTheme(
  120. color: Colors.grey.shade800,
  121. iconTheme: IconThemeData(
  122. color: Colors.grey.shade400
  123. ),
  124. toolbarTextStyle: TextStyle(
  125. color: Colors.grey.shade400
  126. ),
  127. systemOverlayStyle: const SystemUiOverlayStyle(
  128. statusBarColor: Colors.black,
  129. statusBarIconBrightness: Brightness.dark,
  130. statusBarBrightness: Brightness.dark,
  131. )
  132. ),
  133. iconTheme: const IconThemeData(color: Colors.white),
  134. inputDecorationTheme: InputDecorationTheme(
  135. filled: true,
  136. fillColor: Colors.grey.shade800,
  137. hintStyle: TextStyle(
  138. color: Colors.grey.shade500,
  139. ),
  140. iconColor: Colors.grey.shade500,
  141. contentPadding: const EdgeInsets.all(8),
  142. enabledBorder: OutlineInputBorder(
  143. borderRadius: BorderRadius.circular(15),
  144. borderSide: const BorderSide(
  145. color: Colors.transparent,
  146. )
  147. ),
  148. focusedBorder: OutlineInputBorder(
  149. borderRadius: BorderRadius.circular(15),
  150. borderSide: const BorderSide(
  151. color: Colors.transparent,
  152. )
  153. ),
  154. ),
  155. ),
  156. );
  157. }
  158. }