Skip to content

Commit

Permalink
Merge development rework into dev (#4)
Browse files Browse the repository at this point in the history
* wip

* fix to work on macos for dev

* (wip) virtual keyboard

* (fix) revert theme changes

* (fix) change label naming for error screens

* (feat) fix regex for wifi on macos, add refresh

* (etc) various changes

* (fix) Files screen jumps back to top when changing directory.

* (etc) Change placeholder values

* (dev) Move development tests to seperate Debug entry in Settings

* (feat) Add Print Error screen.

* (feat) Add Brightness Control to colors.

* (feat) Initial implementation of custom native onscreen keyboard

---------

Co-authored-by: Ibrahim Mourade <mouradeibrahim@gmail.com>
  • Loading branch information
PaulGD03 and shifubrams authored Feb 18, 2024
1 parent 8af9cb0 commit d5f34ef
Show file tree
Hide file tree
Showing 30 changed files with 1,417 additions and 440 deletions.
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# orion

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
# Orion
----------------------------------
Orion is the front-end user interface for mSLA printers that run our Odyssey print engine.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion 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, '17.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
25 changes: 16 additions & 9 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
PODS:
- Flutter (1.0.0)
- package_info (0.0.1):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
- shared_preferences_ios (0.0.1):
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- wifi_info_flutter (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- wifi_info_flutter (from `.symlinks/plugins/wifi_info_flutter/ios`)

EXTERNAL SOURCES:
Flutter:
:path: Flutter
package_info:
:path: ".symlinks/plugins/package_info/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
wifi_info_flutter:
:path: ".symlinks/plugins/wifi_info_flutter/ios"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
wifi_info_flutter: 55d4c2469034f5b5c38063ccefa62f708a503a2b

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: 5a367937f10bf0c459576e5e472a1159ee029c13

COCOAPODS: 1.14.2
COCOAPODS: 1.14.3
7 changes: 5 additions & 2 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -222,10 +222,12 @@
};
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand All @@ -236,6 +238,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion lib/files/details_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:crypto/crypto.dart';
class DetailScreen extends StatefulWidget {
final File file;

const DetailScreen({Key? key, required this.file}) : super(key: key);
const DetailScreen({super.key, required this.file});

@override
// ignore: library_private_types_in_public_api
Expand Down
47 changes: 34 additions & 13 deletions lib/files/files_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,24 @@ import 'package:path/path.dart' as path;
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

ScrollController _scrollController = ScrollController();

Directory getInitialDir(platform) {
switch (platform) {
case TargetPlatform.macOS:
return Directory('/Users/${Platform.environment['USER']}/Documents');
case TargetPlatform.linux:
return Directory('/home/${Platform.environment['USER']}/printableFiles<');
case TargetPlatform.windows:
return Directory(
'%userprofile%'); // WARN Not sure if that works for windows developers. To be tested
default:
return Directory('/');
}
}

void checkFullDiskAccess(BuildContext context) {
final documentsDir =
Directory('/Users/${Platform.environment['USER']}/Documents');
final documentsDir = getInitialDir(Theme.of(context).platform);
try {
documentsDir.listSync();
} catch (e) {
Expand Down Expand Up @@ -41,7 +56,7 @@ void checkFullDiskAccess(BuildContext context) {

/// The files screen
class FilesScreen extends StatefulWidget {
const FilesScreen({Key? key}) : super(key: key);
const FilesScreen({super.key});
@override
// ignore: library_private_types_in_public_api
_FilesScreenState createState() => _FilesScreenState();
Expand All @@ -55,7 +70,7 @@ class _FilesScreenState extends State<FilesScreen> {

@override
void initState() {
_directory = Directory('/Users/${Platform.environment['USER']}/Downloads');
_directory = getInitialDir(context);
_files = [];
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
Expand All @@ -79,14 +94,13 @@ class _FilesScreenState extends State<FilesScreen> {
return a.path.toLowerCase().compareTo(b.path.toLowerCase());
});
});
_sortByAlpha = false;
_toggleSortOrder();
//_sortByAlpha = false;
//_toggleSortOrder();
});
});
}

void refresh() {
_getFiles();
setState(
() {
_files = _directory
Expand Down Expand Up @@ -132,9 +146,7 @@ class _FilesScreenState extends State<FilesScreen> {
}

Future<void> _getFiles() async {
//final Directory directory = Directory.systemTemp;
final Directory directory =
Directory('/Users/${Platform.environment['USER']}/Downloads');
final Directory directory = getInitialDir(Theme.of(context).platform);
List<FileSystemEntity> files = getAccessibleDirectories(directory);
files = files
.where((file) =>
Expand Down Expand Up @@ -181,7 +193,14 @@ class _FilesScreenState extends State<FilesScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(_directory.path.replaceFirst('/Users/paul/', '')),
title: Text(
path.basename(_directory.path) == 'printer_files'
? 'Print Files'
: path.basename(_directory.path) == 'Download' ||
path.basename(_directory.path) == "Downloads"
? path.basename(_directory.path)
: _directory.path,
),
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 5.0),
Expand Down Expand Up @@ -221,13 +240,14 @@ class _FilesScreenState extends State<FilesScreen> {
body: _directory == null
? const Center(child: CircularProgressIndicator())
: ListView.builder(
controller: _scrollController,
itemCount: _files.length + 1,
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return ListTile(
leading: const Icon(Icons.subdirectory_arrow_left_rounded),
title: Row(
children: const [
title: const Row(
children: [
Text('Leave Directory', style: TextStyle(fontSize: 24)),
],
),
Expand Down Expand Up @@ -305,6 +325,7 @@ class _FilesScreenState extends State<FilesScreen> {
onTap: () {
try {
if (file is Directory) {
_scrollController.jumpTo(0.0);
setState(() {
_directory = file;
_files = file
Expand Down
38 changes: 20 additions & 18 deletions lib/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@ import 'package:go_router/go_router.dart';

class HomeScreen extends StatelessWidget {
/// Constructs a [HomeScreen]
const HomeScreen({Key? key}) : super(key: key);

const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
const Size homeBtnSize = Size(200, 110);
final theme = Theme.of(context).copyWith(
elevatedButtonTheme: ElevatedButtonThemeData(style: ButtonStyle(
minimumSize: MaterialStateProperty.resolveWith<Size?>(
(Set<MaterialState> states) {
return homeBtnSize;
},
),
)));
return Scaffold(
appBar: AppBar(
title: Stack(
Expand Down Expand Up @@ -37,44 +45,38 @@ class HomeScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
style: theme.elevatedButtonTheme.style,
onPressed: () => context.go('/status'),
style: ElevatedButton.styleFrom(
minimumSize: const Size(200, 110),
),
child: Column(
child: const Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const [
children: [
Icon(Icons.info_outline, size: 48),
Text('Status', style: TextStyle(fontSize: 24)),
],
),
),
const SizedBox(width: 20),
ElevatedButton(
style: theme.elevatedButtonTheme.style,
onPressed: () => context.go('/files'),
style: ElevatedButton.styleFrom(
minimumSize: const Size(200, 110),
),
child: Column(
child: const Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const [
children: [
Icon(Icons.folder_open_outlined, size: 48),
Text('Print Files', style: TextStyle(fontSize: 24)),
],
),
),
const SizedBox(width: 20),
ElevatedButton(
style: theme.elevatedButtonTheme.style,
onPressed: () => context.go('/settings'),
style: ElevatedButton.styleFrom(
minimumSize: const Size(200, 110),
),
child: Column(
child: const Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: const [
children: [
Icon(Icons.settings_outlined, size: 48),
Text('Settings', style: TextStyle(fontSize: 24)),
],
Expand All @@ -90,7 +92,7 @@ class HomeScreen extends StatelessWidget {
/// A live clock widget
class LiveClock extends StatefulWidget {
/// Constructs a [LiveClock]
const LiveClock({Key? key}) : super(key: key);
const LiveClock({super.key});

@override
// ignore: library_private_types_in_public_api
Expand Down
14 changes: 4 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/foundation.dart';
import 'package:orion/themes/themes.dart';

import 'home/home_screen.dart';
import 'status/status_screen.dart';
Expand Down Expand Up @@ -80,7 +81,7 @@ final GoRouter _router = GoRouter(
/// The main app.
class Orion extends StatelessWidget {
/// Constructs a [Orion]
const Orion({Key? key}) : super(key: key);
const Orion({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -91,15 +92,8 @@ class Orion extends StatelessWidget {
child: MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: _router,
theme: ThemeData(
brightness: Brightness.light,
colorSchemeSeed: const Color(0xff6750a4),
useMaterial3: true),
darkTheme: ThemeData(
brightness: Brightness.dark,
colorSchemeSeed: const Color(0xff6750a4),
useMaterial3: true,
),
theme: themeLight,
darkTheme: themeDark,
themeMode: ThemeMode.system,
),
);
Expand Down
Loading

0 comments on commit d5f34ef

Please sign in to comment.