Skip to content

Commit

Permalink
Dark theme, redesign, repo clean
Browse files Browse the repository at this point in the history
Dark theme as default, redesign (no rounded corners), repo clean, updated todo, updated appname
  • Loading branch information
lucasverdelho authored Oct 11, 2024
2 parents 03105f1 + e243d46 commit 2c1d2ed
Show file tree
Hide file tree
Showing 30 changed files with 215 additions and 52 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

android/.gradle
android/src/main/java
Binary file removed android/.gradle/8.3/checksums/checksums.lock
Binary file not shown.
Binary file removed android/.gradle/8.3/checksums/md5-checksums.bin
Binary file not shown.
Binary file removed android/.gradle/8.3/checksums/sha1-checksums.bin
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file removed android/.gradle/8.3/fileChanges/last-build.bin
Binary file not shown.
Binary file removed android/.gradle/8.3/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed android/.gradle/8.3/fileHashes/fileHashes.lock
Binary file not shown.
Binary file not shown.
Empty file removed android/.gradle/8.3/gc.properties
Empty file.
Binary file not shown.
2 changes: 0 additions & 2 deletions android/.gradle/buildOutputCleanup/cache.properties

This file was deleted.

Binary file removed android/.gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file removed android/.gradle/file-system.probe
Binary file not shown.
Empty file.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


<application
android:label="mobile"
android:label="ChronoLens"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions android/local.properties

This file was deleted.

42 changes: 42 additions & 0 deletions ios/Runner/GeneratedPluginRegistrant.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,51 @@

#import "GeneratedPluginRegistrant.h"

#if __has_include(<device_info_plus/FPPDeviceInfoPlusPlugin.h>)
#import <device_info_plus/FPPDeviceInfoPlusPlugin.h>
#else
@import device_info_plus;
#endif

#if __has_include(<flutter_secure_storage/FlutterSecureStoragePlugin.h>)
#import <flutter_secure_storage/FlutterSecureStoragePlugin.h>
#else
@import flutter_secure_storage;
#endif

#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
#import <path_provider_foundation/PathProviderPlugin.h>
#else
@import path_provider_foundation;
#endif

#if __has_include(<permission_handler_apple/PermissionHandlerPlugin.h>)
#import <permission_handler_apple/PermissionHandlerPlugin.h>
#else
@import permission_handler_apple;
#endif

#if __has_include(<photo_manager/PhotoManagerPlugin.h>)
#import <photo_manager/PhotoManagerPlugin.h>
#else
@import photo_manager;
#endif

#if __has_include(<shared_preferences_foundation/SharedPreferencesPlugin.h>)
#import <shared_preferences_foundation/SharedPreferencesPlugin.h>
#else
@import shared_preferences_foundation;
#endif

@implementation GeneratedPluginRegistrant

+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FPPDeviceInfoPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"FPPDeviceInfoPlusPlugin"]];
[FlutterSecureStoragePlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterSecureStoragePlugin"]];
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
[PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]];
[PhotoManagerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PhotoManagerPlugin"]];
[SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];
}

@end
7 changes: 3 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:mobile/utils/route_generator.dart';
import 'package:mobile/utils/theme.dart';

void main() {
runApp(const MyApp());
Expand All @@ -13,11 +14,9 @@ class MyApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'ChronoLens',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
theme: AppTheme.darkTheme, // Default is dark theme, add a switch later
initialRoute: "/login",
onGenerateRoute: RouteGenerator.generateRoute,
);
}
}
}
4 changes: 2 additions & 2 deletions lib/screens/gallery_page/image_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class _ImageGridState extends State<ImageGrid> {
pagingController: _pagingController,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisSpacing: 4.0,
mainAxisSpacing: 4.0,
crossAxisSpacing: 2.0,
mainAxisSpacing: 2.0,
),
builderDelegate: PagedChildBuilderDelegate<AssetEntity>(
itemBuilder: (context, asset, index) {
Expand Down
57 changes: 42 additions & 15 deletions lib/screens/gallery_page/preview_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,70 @@ import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:mobile/services/api_service.dart';

class PreviewContainer extends StatelessWidget {
class PreviewContainer extends StatefulWidget {
final AssetEntity asset;
final Uint8List? thumbnail;

const PreviewContainer({Key? key, required this.asset, this.thumbnail})
: super(key: key);

@override
_PreviewContainerState createState() => _PreviewContainerState();
}

class _PreviewContainerState extends State<PreviewContainer> {
bool _isUploaded = false;

Future<String?> _getFilePath(AssetEntity asset) async {
final file = await asset.file;
return file?.path;
}


// #TODO:
Future<void> _uploadFile(String filePath) async {
print('File tapped: ${widget.asset.title}');
await APIServiceClient().uploadFileStream(filePath);

setState(() {
_isUploaded = true;
});
}

@override
Widget build(BuildContext context) {
return thumbnail != null
return widget.thumbnail != null
? GestureDetector(
onTap: () async {
var filePath = await _getFilePath(asset);
var filePath = await _getFilePath(widget.asset);

if (filePath != null) {
print('File tapped: ${asset.title}');
APIServiceClient().uploadFileStream(filePath);
await _uploadFile(filePath);
} else {
print('Error: Unable to retrieve file path');
}
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: MemoryImage(thumbnail!),
fit: BoxFit.cover,
child: Stack(
children: [

Container(
decoration: BoxDecoration(
image: DecorationImage(
image: MemoryImage(widget.thumbnail!),
fit: BoxFit.cover,
),
),
),
borderRadius: BorderRadius.circular(8.0),
),

if (_isUploaded) // Widget for the icon, still need to change all icons to the icon pack in the design
Positioned(
top: 8.0,
right: 8.0,
child: Icon(
Icons.cloud_done,
size: 24.0,
color: Colors.purple.shade400,
),
),
],
),
)
: Container(
Expand Down
4 changes: 3 additions & 1 deletion lib/screens/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: IndexedStack(
index: _currentIndex,
children: _pages,
),
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: _currentIndex,
onTap: (index) {
setState(() {
Expand Down Expand Up @@ -55,7 +57,7 @@ class _HomePageState extends State<HomePage> {
label: 'Settings',
),
],
selectedItemColor: Colors.deepPurpleAccent.shade700,
selectedItemColor: Colors.purple,
unselectedItemColor: Colors.grey,
),
);
Expand Down
10 changes: 10 additions & 0 deletions lib/services/api_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,14 @@ class APIServiceClient {
print("Other exception");
}
}

Future<void> upload(String path /*File file, Map<String, String> fields */) async {
await Future.delayed(Duration(seconds: 2)); // Simulate a delay for upload

// Perform actual upload logic here, e.g., using http.post/multipart, etc.
print('Uploading file at: $path');

return; // Explicitly return a Future<void>
}

}
41 changes: 41 additions & 0 deletions lib/utils/theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

class AppTheme {

// For now we will only use dark theme but it seems simple enough to implement an alternative
// theme overriding the material theme TODO: Add the light theme with a switch button to change somewhere in settings
static ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
scaffoldBackgroundColor: Colors.black,
primarySwatch: Colors.purple,
primaryColor: Colors.purple,
colorScheme: ColorScheme.dark(
primary: Colors.purple, // Primary color for components
secondary: Colors.purple,
onPrimary: Colors.white, // Text color on primary
onSecondary: Colors.white, // Text color on secondary
surface: Colors.black,
),
iconTheme: const IconThemeData( // TODO: Find out how to import the icons from the design
color: Colors.white,
),
textTheme: GoogleFonts.outfitTextTheme( // Outfit font from google fonts TODO: I think its free to use but gotta check the license
ThemeData.dark().textTheme,
),
appBarTheme: const AppBarTheme(
backgroundColor: Colors.black,
titleTextStyle: TextStyle(color: Colors.white, fontSize: 20),
iconTheme: IconThemeData(color: Colors.white),
),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Colors.black,
selectedItemColor: Colors.purple,
unselectedItemColor: Colors.white,
selectedIconTheme: const IconThemeData(color: Colors.purple),
unselectedIconTheme: const IconThemeData(color: Colors.white),
elevation: 0, // Apparently removes shadow
type: BottomNavigationBarType.fixed,
),
);
}
68 changes: 66 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ packages:
source: hosted
version: "3.1.1"
crypto:
dependency: transitive
dependency: "direct main"
description:
name: crypto
sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27
Expand Down Expand Up @@ -333,6 +333,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
url: "https://pub.dev"
source: hosted
version: "6.2.1"
google_identity_services_web:
dependency: transitive
description:
Expand Down Expand Up @@ -693,6 +701,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.0"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "3b9febd815c9ca29c9e3520d50ec32f49157711e143b7a4ca039eb87e8ade5ab"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d"
url: "https://pub.dev"
source: hosted
version: "2.5.3"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e
url: "https://pub.dev"
source: hosted
version: "2.4.2"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
shelf:
dependency: transitive
description:
Expand Down Expand Up @@ -876,4 +940,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.5.3 <4.0.0"
flutter: ">=3.22.0"
flutter: ">=3.24.0"
Loading

0 comments on commit 2c1d2ed

Please sign in to comment.