Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
🐛 changed the urls. fixes #9 and #10
Browse files Browse the repository at this point in the history
  • Loading branch information
adeeteya committed Mar 29, 2023
1 parent 1d65945 commit 2b0a19d
Show file tree
Hide file tree
Showing 80 changed files with 189 additions and 135 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Please star⭐ the repo if you like what you see😊.
[<img src="https://images-na.ssl-images-amazon.com/images/G/01/mobile-apps/devportal2/res/images/amazon-appstore-badge-english-black.png" width="250">](https://www.amazon.com/gp/product/B09ZBGJR9G)
(or)

[![Download apk](https://img.shields.io/badge/Download-apk-green)](https://github.com/adityar224/Random-Face-Generator/releases/download/2.2.0/RFG-Android-2.2.0.apk)
[![Download apk](https://img.shields.io/badge/Download-apk-green)](https://github.com/adityar224/Random-Face-Generator/releases/download/3.0.0/RFG-Android-3.0.0.apk)

### Linux

Expand Down Expand Up @@ -52,7 +52,7 @@ Please star⭐ the repo if you like what you see😊.
```

### Windows
[![Download exe](https://img.shields.io/badge/Download-exe-blue)](https://github.com/adityar224/Random-Face-Generator/releases/download/2.2.0/RFG-Windows-2.2.0.exe)
[![Download exe](https://img.shields.io/badge/Download-exe-blue)](https://github.com/adityar224/Random-Face-Generator/releases/download/3.0.0/RFG-Windows-3.0.0.exe)

### Mac Os
[![Download dmg](https://img.shields.io/badge/Download-dmg-lightgrey)](https://github.com/adityar224/Random-Face-Generator/releases/download/2.1.0/RFG-Macos-2.1.0.dmg)
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Binary file modified android/app/src/main/res/drawable-hdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-hdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-mdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-v21/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-v21/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxxhdpi/android12splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
1 change: 1 addition & 0 deletions android/app/src/main/res/values-night-v31/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#292D32</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values-v31/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#E0E5EC</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/android12splash</item>
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
Binary file modified assets/app_icon.png
Binary file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
2 changes: 1 addition & 1 deletion ios/Runner/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="512" height="512"/>
<image name="LaunchImage" width="768" height="768"/>
<image name="LaunchBackground" width="1" height="1"/>
</resources>
</document>
8 changes: 4 additions & 4 deletions lib/constants.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';

const String kDefaultUrl = "https://fakeface.rest/face/json";
const String kInitialUrl = "https://thispersondoesnotexist.com/image";
const String kCorsProxyUrl = "https://easy-puce-walkingstick-sock.cyclic.app/";
const String kHiveSystemPrefs = "system_prefs";
const kLightBackgroundColor = Color(0xFFE0E5EC);
const kLightSourceColor = Color(0x99FFFFFF);
Expand All @@ -14,8 +12,9 @@ const kRegentGray = Color(0xFF7E8A9A);
const kLimeGreen = Color(0xFF32C94E);

final ThemeData kLightTheme = ThemeData(
useMaterial3: true,
brightness: Brightness.light,
backgroundColor: kLightBackgroundColor,
colorScheme: const ColorScheme.light(background: kLightBackgroundColor),
scaffoldBackgroundColor: kLightBackgroundColor,
appBarTheme: const AppBarTheme(
backgroundColor: kLightBackgroundColor,
Expand All @@ -24,8 +23,9 @@ final ThemeData kLightTheme = ThemeData(
snackBarTheme: const SnackBarThemeData(backgroundColor: kDarkBackgroundColor),
);
final ThemeData kDarkTheme = ThemeData(
useMaterial3: true,
brightness: Brightness.dark,
backgroundColor: kDarkBackgroundColor,
colorScheme: const ColorScheme.dark(background: kDarkBackgroundColor),
scaffoldBackgroundColor: kDarkBackgroundColor,
appBarTheme: const AppBarTheme(
backgroundColor: kDarkBackgroundColor,
Expand Down
17 changes: 5 additions & 12 deletions lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ class _HomeState extends State<Home> {
@override
void initState() {
queryUrl = kDefaultUrl;
imageUrl = kInitialUrl;
if (kIsWeb) imageUrl = kCorsProxyUrl + imageUrl;
super.initState();
_fetchImage();
}
Expand Down Expand Up @@ -94,8 +92,8 @@ class _HomeState extends State<Home> {
}
}

Future _displayErrorAlert(String title, String content) {
return showDialog(
Future _displayErrorAlert(String title, String content) async {
return await showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(title),
Expand All @@ -119,13 +117,8 @@ class _HomeState extends State<Home> {
_loading = true;
});
try {
if (queryUrl == kDefaultUrl) {
imageUrl = kInitialUrl;
if (kIsWeb) imageUrl = kCorsProxyUrl + imageUrl;
} else {
final response = await http.get(Uri.parse(queryUrl));
imageUrl = Face.fromJson(jsonDecode(response.body)).imageUrl;
}
final response = await http.get(Uri.parse(queryUrl));
imageUrl = Face.fromJson(jsonDecode(response.body)).imageUrl;
imageList = await http.readBytes(Uri.parse(imageUrl));
} catch (e) {
if (e.runtimeType == SocketException) {
Expand Down Expand Up @@ -224,7 +217,7 @@ class _HomeState extends State<Home> {

Widget _buildSlider() {
return Container(
height: 70,
height: 71,
padding: const EdgeInsets.symmetric(vertical: 8),
decoration: CustomTheme(widget.isDark).boxDecoration,
child: Column(
Expand Down
15 changes: 9 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ import 'package:random_face_generator/constants.dart';
import 'package:random_face_generator/home.dart';

void main() async {
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarColor: Colors.transparent),
);
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
statusBarColor: Colors.transparent,
),
);
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
await Hive.initFlutter();
await Hive.openBox(kHiveSystemPrefs);
FlutterNativeSplash.remove();
Expand All @@ -28,11 +32,10 @@ class RandomFaceGeneratorApp extends StatelessWidget {
bool isDark = box.get("darkMode",
defaultValue: ThemeMode.system == ThemeMode.dark);
return MaterialApp(
title: "Random Face Generator",
debugShowCheckedModeBanner: false,
theme: isDark ? kDarkTheme : kLightTheme,
home: Home(
isDark: isDark,
),
home: Home(isDark: isDark),
);
},
);
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/neumorphic_elevated_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class NeumorphicElevatedButtonState extends State<NeumorphicElevatedButton> {
duration: const Duration(milliseconds: 300),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(8),
boxShadow: !_isPressed ? customTheme.boxShadows : null,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/neumorphic_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class NeumorphicIconButtonState extends State<NeumorphicIconButton> {
duration: const Duration(milliseconds: 300),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
shape: BoxShape.circle,
gradient: (_isPressed)
? null
Expand Down
2 changes: 1 addition & 1 deletion macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import FlutterMacOS
import Foundation

import path_provider_macos
import path_provider_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
Loading

0 comments on commit 2b0a19d

Please sign in to comment.