Skip to content

Commit

Permalink
Set theme
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k committed Jan 24, 2024
1 parent ca5605f commit 1e98f82
Show file tree
Hide file tree
Showing 20 changed files with 755 additions and 16 deletions.
20 changes: 18 additions & 2 deletions .idea/libraries/Dart_Packages.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion app/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
4 changes: 2 additions & 2 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ SPEC CHECKSUMS:
firebase_core: 0af4a2b24f62071f9bf283691c0ee41556dcb3f5
FirebaseCore: 2322423314d92f946219c8791674d2f3345b598f
FirebaseCoreInternal: b444828ea7cfd594fca83046b95db98a2be4f290
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
google_sign_in_ios: 1bfaf6607b44cd1b24c4d4bc39719870440f9ce1
GoogleSignIn: b232380cf495a429b8095d3178a8d5855b42e842
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
GTMAppAuth: 99fb010047ba3973b7026e45393f51f27ab965ae
GTMSessionFetcher: 41b9ef0b4c08a6db4b7eb51a21ae5183ec99a2c8
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

COCOAPODS: 1.14.3
6 changes: 3 additions & 3 deletions app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -603,7 +603,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -652,7 +652,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
28 changes: 27 additions & 1 deletion app/lib/ui/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:style/theme/theme.dart';
import 'package:style/theme/app_theme_builder.dart';

class App extends StatefulWidget {
const App({super.key});
Expand All @@ -18,26 +20,50 @@ class _AppState extends State<App> {

@override
void initState() {
_router = GoRouter(initialLocation: AppRoutePath.home, routes: AppRouter.routes);
_router = GoRouter(
initialLocation: AppRoutePath.home,
routes: AppRouter.routes,
);
super.initState();
}

@override
Widget build(BuildContext context) {
final colorScheme =
context.isDarkMode ? appColorSchemeDark : appColorSchemeLight;
return AppTheme(
colorScheme: colorScheme,
child: _buildApp(
context: context,
colorScheme: colorScheme,
),
);
}

Widget _buildApp({
required BuildContext context,
required AppColorScheme colorScheme,
}) {
if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
return CupertinoApp.router(
onGenerateTitle: (context) => context.l10n.app_name,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
routerConfig: _router,
theme: AppThemeBuilder.cupertinoThemeFromColorScheme(
colorScheme: colorScheme,
),
);
}
return MaterialApp.router(
onGenerateTitle: (context) => context.l10n.app_name,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
routerConfig: _router,
theme: AppThemeBuilder.materialThemeFromColorScheme(
colorScheme: colorScheme,
),
);
}
}
10 changes: 7 additions & 3 deletions app/lib/ui/flow/main/main_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:cloud_gallery/utils/extensions/context_extensions.dart';
import 'package:flutter/material.dart';
import 'package:style/text/app_text_style.dart';

class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
Expand All @@ -10,10 +12,12 @@ class HomeScreen extends StatefulWidget {
class _MainScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return const Scaffold(
return Scaffold(
backgroundColor: context.colorScheme.surface,
body: Center(
child: Text('Home Screen'),
),
child: Text('Home Screen',
style: AppTextStyles.subtitle2
.copyWith(color: context.colorScheme.textPrimary))),
);
}
}
13 changes: 13 additions & 0 deletions app/lib/utils/extensions/context_extensions.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:style/theme/theme.dart';

extension BuildContextExtensions on BuildContext {
AppLocalizations get l10n => AppLocalizations.of(this);

EdgeInsets get systemPadding => MediaQuery.of(this).padding;

Size get mediaQuerySize => MediaQuery.of(this).size;

AppColorScheme get colorScheme => appColorSchemeOf(this);

Brightness get brightness => MediaQuery.of(this).platformBrightness;

bool get isDarkMode => brightness == Brightness.dark;

FocusScopeNode get focusScope => FocusScope.of(this);

bool get use24Hour => MediaQuery.of(this).alwaysUse24HourFormat;
}
16 changes: 16 additions & 0 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.8.1"
json_serializable:
dependency: transitive
description:
name: json_serializable
sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969
url: "https://pub.dev"
source: hosted
version: "6.7.1"
lints:
dependency: transitive
description:
Expand Down Expand Up @@ -665,6 +673,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.0"
source_helper:
dependency: transitive
description:
name: source_helper
sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd"
url: "https://pub.dev"
source: hosted
version: "1.3.4"
source_span:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion data/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"google_sign_in_android","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.21/","native_build":true,"dependencies":[]}],"macos":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"google_sign_in_web","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.3+2/","dependencies":[]}]},"dependencyGraph":[{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]}],"date_created":"2024-01-17 19:19:20.833539","version":"3.16.7"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"google_sign_in_android","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.21/","native_build":true,"dependencies":[]}],"macos":[{"name":"google_sign_in_ios","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"google_sign_in_web","path":"/Users/pratikcanopas/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.3+2/","dependencies":[]}]},"dependencyGraph":[{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]}],"date_created":"2024-01-23 10:35:50.290203","version":"3.16.7"}
19 changes: 19 additions & 0 deletions data/lib/models/media/media.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:freezed_annotation/freezed_annotation.dart';

part 'media.freezed.dart';
part 'media.g.dart';

@freezed
class Media with _$Media {
const factory Media({
required String id,
required String name,
required String image,
required double size,
String? mimeType,
required DateTime createdTime,
DateTime? modifiedTime,
}) = _Media;

factory Media.fromJson(Map<String, dynamic> json) => _$MediaFromJson(json);
}
Loading

0 comments on commit 1e98f82

Please sign in to comment.