Compare commits
24 Commits
fix/tab-na
...
main
Author | SHA1 | Date | |
---|---|---|---|
51f01a661a | |||
|
0331605e1e | ||
|
11b040ae9e | ||
|
1f1bc63bc1 | ||
|
e5f1c55993 | ||
|
596abc850c | ||
|
b6699831d7 | ||
|
371421a049 | ||
|
1b508f3200 | ||
|
dadb6275fc | ||
|
c00dae0b97 | ||
|
01ba5f624f | ||
|
e41f2ba530 | ||
|
1dfa1574c8 | ||
|
095205d047 | ||
|
648eac7298 | ||
|
a1f2a778a2 | ||
|
7f892df3c8 | ||
|
9c64993cff | ||
|
097295f393 | ||
|
bb2564efdd | ||
|
85379a148a | ||
|
8d5daf3edd | ||
|
45a9a8348f |
@ -9,6 +9,11 @@
|
|||||||
# packages, and plugins designed to encourage good coding practices.
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
errors:
|
||||||
|
prefer_const_constructors: ignore
|
||||||
|
unused_element: ignore # mostly because of super.key
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
# The lint rules applied to this project can be customized in the
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
@ -22,9 +27,8 @@ linter:
|
|||||||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||||
# producing the lint.
|
# producing the lint.
|
||||||
rules:
|
rules:
|
||||||
always_declare_return_types: true
|
- always_declare_return_types
|
||||||
always_use_package_imports: true
|
- always_use_package_imports
|
||||||
prefer_const_constructors: false
|
- prefer_single_quotes
|
||||||
prefer_single_quotes: true
|
|
||||||
# Additional information about this file can be found at
|
# Additional information about this file can be found at
|
||||||
# https://dart.dev/guides/language/analysis-options
|
# https://dart.dev/guides/language/analysis-options
|
||||||
|
@ -33,7 +33,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion flutter.compileSdkVersion
|
compileSdkVersion 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
configurations.all {
|
configurations.all {
|
||||||
|
@ -80,4 +80,4 @@ SPEC CHECKSUMS:
|
|||||||
|
|
||||||
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
|
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
|
||||||
|
|
||||||
COCOAPODS: 1.11.3
|
COCOAPODS: 1.15.0
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
296251252AE7410D00D574FF /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 296251242AE7410D00D574FF /* Colors.swift */; };
|
296251252AE7410D00D574FF /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 296251242AE7410D00D574FF /* Colors.swift */; };
|
||||||
|
2978ECDD2B62D00C00E36CE8 /* FlutterAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2978ECDC2B62D00C00E36CE8 /* FlutterAssets.swift */; };
|
||||||
297F6FC72AD06E0D00FF159E /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 297F6FC62AD06E0D00FF159E /* WidgetKit.framework */; };
|
297F6FC72AD06E0D00FF159E /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 297F6FC62AD06E0D00FF159E /* WidgetKit.framework */; };
|
||||||
297F6FC92AD06E0D00FF159E /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 297F6FC82AD06E0D00FF159E /* SwiftUI.framework */; };
|
297F6FC92AD06E0D00FF159E /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 297F6FC82AD06E0D00FF159E /* SwiftUI.framework */; };
|
||||||
297F6FCC2AD06E0D00FF159E /* WonderousWidgetBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 297F6FCB2AD06E0D00FF159E /* WonderousWidgetBundle.swift */; };
|
297F6FCC2AD06E0D00FF159E /* WonderousWidgetBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 297F6FCB2AD06E0D00FF159E /* WonderousWidgetBundle.swift */; };
|
||||||
@ -73,6 +74,7 @@
|
|||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
|
||||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
296251242AE7410D00D574FF /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
|
296251242AE7410D00D574FF /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
|
||||||
|
2978ECDC2B62D00C00E36CE8 /* FlutterAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlutterAssets.swift; sourceTree = "<group>"; };
|
||||||
297F6FC52AD06E0D00FF159E /* Wonderous WidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; name = "Wonderous WidgetExtension.appex"; path = WonderousWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
297F6FC52AD06E0D00FF159E /* Wonderous WidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; name = "Wonderous WidgetExtension.appex"; path = WonderousWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
297F6FC62AD06E0D00FF159E /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
297F6FC62AD06E0D00FF159E /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
||||||
297F6FC82AD06E0D00FF159E /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
297F6FC82AD06E0D00FF159E /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
||||||
@ -141,6 +143,7 @@
|
|||||||
297FD5732AE18011008D8BFE /* WonderousWidgetView.swift */,
|
297FD5732AE18011008D8BFE /* WonderousWidgetView.swift */,
|
||||||
297FD5752AE19BD9008D8BFE /* WonderWidgetViewComponents.swift */,
|
297FD5752AE19BD9008D8BFE /* WonderWidgetViewComponents.swift */,
|
||||||
296251242AE7410D00D574FF /* Colors.swift */,
|
296251242AE7410D00D574FF /* Colors.swift */,
|
||||||
|
2978ECDC2B62D00C00E36CE8 /* FlutterAssets.swift */,
|
||||||
);
|
);
|
||||||
path = WonderousWidget;
|
path = WonderousWidget;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -451,6 +454,7 @@
|
|||||||
297FD5762AE19BD9008D8BFE /* WonderWidgetViewComponents.swift in Sources */,
|
297FD5762AE19BD9008D8BFE /* WonderWidgetViewComponents.swift in Sources */,
|
||||||
296251252AE7410D00D574FF /* Colors.swift in Sources */,
|
296251252AE7410D00D574FF /* Colors.swift in Sources */,
|
||||||
297F6FD32AD06E0F00FF159E /* WonderousWidget.intentdefinition in Sources */,
|
297F6FD32AD06E0F00FF159E /* WonderousWidget.intentdefinition in Sources */,
|
||||||
|
2978ECDD2B62D00C00E36CE8 /* FlutterAssets.swift in Sources */,
|
||||||
297FD5742AE18011008D8BFE /* WonderousWidgetView.swift in Sources */,
|
297FD5742AE18011008D8BFE /* WonderousWidgetView.swift in Sources */,
|
||||||
297F6FCE2AD06E0D00FF159E /* WonderousWidget.swift in Sources */,
|
297F6FCE2AD06E0D00FF159E /* WonderousWidget.swift in Sources */,
|
||||||
297F6FCC2AD06E0D00FF159E /* WonderousWidgetBundle.swift in Sources */,
|
297F6FCC2AD06E0D00FF159E /* WonderousWidgetBundle.swift in Sources */,
|
||||||
@ -640,14 +644,14 @@
|
|||||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_ENTITLEMENTS = "WonderousWidgetExtension.entitlements";
|
CODE_SIGN_ENTITLEMENTS = WonderousWidgetExtension.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = S3TL5AY6Y3;
|
DEVELOPMENT_TEAM = S3TL5AY6Y3;
|
||||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
INFOPLIST_FILE = "WonderousWidget/Info.plist";
|
INFOPLIST_FILE = WonderousWidget/Info.plist;
|
||||||
INFOPLIST_KEY_CFBundleDisplayName = "Wonderous Widget";
|
INFOPLIST_KEY_CFBundleDisplayName = "Wonderous Widget";
|
||||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
/// Define some custom extensions on the Color class, so we can use the shorthand syntax `..myColor`
|
||||||
extension Color {
|
extension Color {
|
||||||
public static let accent = Color(red: 0.89, green: 0.58, blue: 0.36)
|
public static let accent = Color(red: 0.89, green: 0.58, blue: 0.36)
|
||||||
public static let offWhite = Color(red: 0.97, green: 0.92, blue: 0.9)
|
public static let offWhite = Color(red: 0.97, green: 0.92, blue: 0.9)
|
||||||
|
22
ios/WonderousWidget/FlutterAssets.swift
Normal file
22
ios/WonderousWidget/FlutterAssets.swift
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct FlutterImages {
|
||||||
|
static let bgEmpty = getAssetPath("/assets/images/widget/background-empty.jpg")
|
||||||
|
static let icon = getAssetPath("/assets/images/widget/wonderous-icon.png")
|
||||||
|
}
|
||||||
|
|
||||||
|
func getAssetPath(_ path : String) -> String {
|
||||||
|
return assetBundleUrl.appending(path: path).path()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a file path to the location of the flutter assetBundle
|
||||||
|
var assetBundleUrl: URL {
|
||||||
|
let bundle = Bundle.main
|
||||||
|
if bundle.bundleURL.pathExtension == "appex" {
|
||||||
|
// Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
|
||||||
|
var url = bundle.bundleURL.deletingLastPathComponent().deletingLastPathComponent()
|
||||||
|
url.append(component: "Frameworks/App.framework/flutter_assets")
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
return bundle.bundleURL
|
||||||
|
}
|
@ -10,15 +10,14 @@ struct BgImage : View {
|
|||||||
var uiImage:UIImage?;
|
var uiImage:UIImage?;
|
||||||
// If there is no saved imageData, use the default bg image
|
// If there is no saved imageData, use the default bg image
|
||||||
if(entry.imageData.isEmpty){
|
if(entry.imageData.isEmpty){
|
||||||
let defaultImage = flutterAssetBundle.appending(path: "/assets/images/widget/background-empty.jpg").path();
|
uiImage = UIImage(contentsOfFile: FlutterImages.bgEmpty);
|
||||||
uiImage = UIImage(contentsOfFile: defaultImage);
|
|
||||||
}
|
}
|
||||||
// Load a base64 encoded image that has been written by the flutter app
|
// Load a base64 encoded image that has been written by the flutter app
|
||||||
else {
|
else {
|
||||||
uiImage = UIImage(data: Data(base64Encoded: entry.imageData)!)
|
uiImage = UIImage(data: Data(base64Encoded: entry.imageData)!)
|
||||||
}
|
}
|
||||||
if(uiImage != nil){
|
if(uiImage != nil){
|
||||||
// Use geometry reader to prevent the image from pushing the other content out of the widgets bounds (https://stackoverflow.com/questions/57593552/swiftui-prevent-image-from-expanding-view-rect-outside-of-screen-bounds)
|
// Use geometry reader to prevent an oversized bg image from pushing the other content out of the widgets bounds (https://stackoverflow.com/questions/57593552/swiftui-prevent-image-from-expanding-view-rect-outside-of-screen-bounds)
|
||||||
let image = GeometryReader { geometry in
|
let image = GeometryReader { geometry in
|
||||||
Image(uiImage: uiImage!)
|
Image(uiImage: uiImage!)
|
||||||
.resizable()
|
.resizable()
|
||||||
@ -34,6 +33,7 @@ struct BgImage : View {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Declares a restyled version of the native ProgressView
|
||||||
struct GaugeProgressStyle: ProgressViewStyle {
|
struct GaugeProgressStyle: ProgressViewStyle {
|
||||||
func makeBody(configuration: Configuration) -> some View {
|
func makeBody(configuration: Configuration) -> some View {
|
||||||
let fractionCompleted = configuration.fractionCompleted ?? 0
|
let fractionCompleted = configuration.fractionCompleted ?? 0
|
||||||
|
@ -2,19 +2,20 @@ import WidgetKit
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Intents
|
import Intents
|
||||||
|
|
||||||
/// Entry, is passed into the view and defines the data it needs
|
/// Every home-widget requires a TimelineEntry. This is passed into the view and propvides any data it needs
|
||||||
struct WonderousTimelineEntry : TimelineEntry {
|
struct WonderousTimelineEntry : TimelineEntry {
|
||||||
|
// Date is a mandatory field for all TimelineEntries
|
||||||
let date: Date
|
let date: Date
|
||||||
|
// Custom field for the wonderous view
|
||||||
let discoveredCount:Int;
|
let discoveredCount:Int;
|
||||||
var title:String = "";
|
var title:String = "";
|
||||||
var subTitle:String = "";
|
var subTitle:String = "";
|
||||||
var imageData:String = "";
|
var imageData:String = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget, defines the display name and description and also declared the main View
|
/// Widget, defines some high level configuration options as well as the primary view that will display the widget.
|
||||||
struct WonderousWidget: Widget {
|
struct WonderousWidget: Widget {
|
||||||
let kind: String = "WonderousWidget"
|
let kind: String = "WonderousWidget"
|
||||||
|
|
||||||
var body: some WidgetConfiguration {
|
var body: some WidgetConfiguration {
|
||||||
StaticConfiguration(kind: kind, provider: WonderousTimelineProvider()) { entry in
|
StaticConfiguration(kind: kind, provider: WonderousTimelineProvider()) { entry in
|
||||||
WonderousWidgetView(entry: entry)
|
WonderousWidgetView(entry: entry)
|
||||||
@ -26,7 +27,12 @@ struct WonderousWidget: Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Provider,returns various WonderousEntry configs based on current context
|
struct WonderousConfig {
|
||||||
|
let iosKey = "group.com.gskinner.flutter.wonders.widget"
|
||||||
|
let discoveredCountKey = "dicoveredCount"
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TimelineProvider, returns various WonderousTimelineEntry configurations for different contexts
|
||||||
struct WonderousTimelineProvider: TimelineProvider {
|
struct WonderousTimelineProvider: TimelineProvider {
|
||||||
// Provide an entry for a placeholder version of the widget
|
// Provide an entry for a placeholder version of the widget
|
||||||
func placeholder(in context: Context) -> WonderousTimelineEntry {
|
func placeholder(in context: Context) -> WonderousTimelineEntry {
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
//
|
|
||||||
// WonderousWidgetBundle.swift
|
|
||||||
// Wonderous Widget
|
|
||||||
//
|
|
||||||
// Created by Shawn on 2023-10-06.
|
|
||||||
//
|
|
||||||
|
|
||||||
import WidgetKit
|
import WidgetKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
// WonderousWidgetBundle
|
||||||
|
// -> WonderousWidgetView
|
||||||
|
// -> WonderousWidgetViewComponents
|
||||||
@main
|
@main
|
||||||
struct WonderousWidgetBundle: WidgetBundle {
|
struct WonderousWidgetBundle: WidgetBundle {
|
||||||
var body: some Widget {
|
var body: some Widget {
|
||||||
|
@ -2,7 +2,7 @@ import WidgetKit
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Intents
|
import Intents
|
||||||
|
|
||||||
// Defines the view / layout of the widget
|
/// Defines the view / layout of the widget
|
||||||
struct WonderousWidgetView : View {
|
struct WonderousWidgetView : View {
|
||||||
@Environment(\.widgetFamily) var family: WidgetFamily
|
@Environment(\.widgetFamily) var family: WidgetFamily
|
||||||
var entry: WonderousTimelineProvider.Entry
|
var entry: WonderousTimelineProvider.Entry
|
||||||
@ -10,14 +10,13 @@ struct WonderousWidgetView : View {
|
|||||||
let showTitle = family == .systemLarge
|
let showTitle = family == .systemLarge
|
||||||
let showIcon = family != .systemSmall
|
let showIcon = family != .systemSmall
|
||||||
let showTitleAndDesc = family != .systemSmall
|
let showTitleAndDesc = family != .systemSmall
|
||||||
|
let progressPct = Double(entry.discoveredCount) / 24.0
|
||||||
let progress = Double(entry.discoveredCount) / 24.0
|
let iconImage = FlutterImages.icon;
|
||||||
let iconImage = flutterAssetBundle.appending(
|
|
||||||
path: "/assets/images/widget/wonderous-icon.png"
|
|
||||||
).path()
|
|
||||||
let title = entry.title.isEmpty ? "Wonderous" : entry.title;
|
let title = entry.title.isEmpty ? "Wonderous" : entry.title;
|
||||||
let subTitle = entry.subTitle.isEmpty ? "Search for hidden artifacts" : entry.subTitle;
|
let subTitle = entry.subTitle.isEmpty ? "Search for hidden artifacts" : entry.subTitle;
|
||||||
|
|
||||||
let content = VStack{
|
let content = VStack{
|
||||||
|
// Top row with optional Title and Icon
|
||||||
HStack {
|
HStack {
|
||||||
if(showTitle) {
|
if(showTitle) {
|
||||||
Text("Collection")
|
Text("Collection")
|
||||||
@ -32,7 +31,10 @@ struct WonderousWidgetView : View {
|
|||||||
.frame(height: 24)
|
.frame(height: 24)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer();
|
Spacer();
|
||||||
|
|
||||||
|
// Bottom hz row with title, desc and progress gauge
|
||||||
HStack {
|
HStack {
|
||||||
if(showTitleAndDesc) {
|
if(showTitleAndDesc) {
|
||||||
VStack(alignment: .leading){
|
VStack(alignment: .leading){
|
||||||
@ -46,14 +48,16 @@ struct WonderousWidgetView : View {
|
|||||||
}
|
}
|
||||||
Spacer();
|
Spacer();
|
||||||
ZStack{
|
ZStack{
|
||||||
ProgressView(value: progress)
|
ProgressView(value: progressPct)
|
||||||
.progressViewStyle(GaugeProgressStyle())
|
.progressViewStyle(GaugeProgressStyle())
|
||||||
.frame(width: 48, height: 48)
|
.frame(width: 48, height: 48)
|
||||||
Text("\(Int(progress * 100))%").font(.system(size: 13)).foregroundColor(.white)
|
|
||||||
|
Text("\(Int((progressPct * 100).rounded()))%").font(.system(size: 13)).foregroundColor(.white)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stack content on top of the background image and a gradient
|
||||||
return ZStack{
|
return ZStack{
|
||||||
BgImage(entry: entry).opacity(0.8)
|
BgImage(entry: entry).opacity(0.8)
|
||||||
LinearGradient(
|
LinearGradient(
|
||||||
@ -62,21 +66,11 @@ struct WonderousWidgetView : View {
|
|||||||
endPoint: .bottom)
|
endPoint: .bottom)
|
||||||
content.padding(16)
|
content.padding(16)
|
||||||
}
|
}
|
||||||
|
// Ios requires that widgets have a background color
|
||||||
.widgetBackground(Color.darkGrey)
|
.widgetBackground(Color.darkGrey)
|
||||||
|
// Deeplink into collections view when tapped
|
||||||
.widgetURL(URL(string: "wonderous:///home/collection"))
|
.widgetURL(URL(string: "wonderous:///home/collection"))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: Refactor to getFlutterAsset(String path), include /assets, or maybe just getFlutterImage(String path), include assets/images
|
|
||||||
// Returns a file path to the location of the flutter assetBundle
|
|
||||||
var flutterAssetBundle: URL {
|
|
||||||
let bundle = Bundle.main
|
|
||||||
if bundle.bundleURL.pathExtension == "appex" {
|
|
||||||
// Peel off two directory levels - MY_APP.app/PlugIns/MY_APP_EXTENSION.appex
|
|
||||||
var url = bundle.bundleURL.deletingLastPathComponent().deletingLastPathComponent()
|
|
||||||
url.append(component: "Frameworks/App.framework/flutter_assets")
|
|
||||||
return url
|
|
||||||
}
|
|
||||||
return bundle.bundleURL
|
|
||||||
}
|
|
||||||
|
@ -16,7 +16,7 @@ final int maxYear = wondersLogic.timelineEndYear;
|
|||||||
const int maxRequests = 32;
|
const int maxRequests = 32;
|
||||||
|
|
||||||
class ArtifactSearchHelper extends StatefulWidget {
|
class ArtifactSearchHelper extends StatefulWidget {
|
||||||
const ArtifactSearchHelper({Key? key}) : super(key: key);
|
const ArtifactSearchHelper({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ArtifactSearchHelper> createState() => _ArtifactSearchHelperState();
|
State<ArtifactSearchHelper> createState() => _ArtifactSearchHelperState();
|
||||||
@ -161,10 +161,14 @@ class _ArtifactSearchHelperState extends State<ArtifactSearchHelper> {
|
|||||||
//if (!json.containsKey('isPublicDomain') || !json['isPublicDomain']) return _logError(id, 'not public domain')
|
//if (!json.containsKey('isPublicDomain') || !json['isPublicDomain']) return _logError(id, 'not public domain')
|
||||||
|
|
||||||
final int year = ((json['objectBeginDate'] as int) + (json['objectEndDate'] as int)) ~/ 2;
|
final int year = ((json['objectBeginDate'] as int) + (json['objectEndDate'] as int)) ~/ 2;
|
||||||
if (year < minYear || year > maxYear) return _logError(id, 'year is out of range');
|
if (year < minYear || year > maxYear) {
|
||||||
|
return _logError(id, 'year is out of range');
|
||||||
|
}
|
||||||
|
|
||||||
String? imageUrlSmall = json['primaryImageSmall'];
|
String? imageUrlSmall = json['primaryImageSmall'];
|
||||||
if (imageUrlSmall == null || imageUrlSmall.isEmpty) return _logError(id, 'no small image url');
|
if (imageUrlSmall == null || imageUrlSmall.isEmpty) {
|
||||||
|
return _logError(id, 'no small image url');
|
||||||
|
}
|
||||||
// if (!imageUrlSmall.startsWith(SearchData.baseImagePath)) {
|
// if (!imageUrlSmall.startsWith(SearchData.baseImagePath)) {
|
||||||
// return _logError(id, 'unexpected image uri: "$imageUrlSmall"');
|
// return _logError(id, 'unexpected image uri: "$imageUrlSmall"');
|
||||||
// }
|
// }
|
||||||
|
@ -43,24 +43,16 @@ class SvgPaths {
|
|||||||
/// For wonder specific assets, add an extension to [WonderType] for easy lookup
|
/// For wonder specific assets, add an extension to [WonderType] for easy lookup
|
||||||
extension WonderAssetExtensions on WonderType {
|
extension WonderAssetExtensions on WonderType {
|
||||||
String get assetPath {
|
String get assetPath {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case WonderType.pyramidsGiza:
|
WonderType.pyramidsGiza => '${ImagePaths.root}/pyramids',
|
||||||
return '${ImagePaths.root}/pyramids';
|
WonderType.greatWall => '${ImagePaths.root}/great_wall_of_china',
|
||||||
case WonderType.greatWall:
|
WonderType.petra => '${ImagePaths.root}/petra',
|
||||||
return '${ImagePaths.root}/great_wall_of_china';
|
WonderType.colosseum => '${ImagePaths.root}/colosseum',
|
||||||
case WonderType.petra:
|
WonderType.chichenItza => '${ImagePaths.root}/chichen_itza',
|
||||||
return '${ImagePaths.root}/petra';
|
WonderType.machuPicchu => '${ImagePaths.root}/machu_picchu',
|
||||||
case WonderType.colosseum:
|
WonderType.tajMahal => '${ImagePaths.root}/taj_mahal',
|
||||||
return '${ImagePaths.root}/colosseum';
|
WonderType.christRedeemer => '${ImagePaths.root}/christ_the_redeemer'
|
||||||
case WonderType.chichenItza:
|
};
|
||||||
return '${ImagePaths.root}/chichen_itza';
|
|
||||||
case WonderType.machuPicchu:
|
|
||||||
return '${ImagePaths.root}/machu_picchu';
|
|
||||||
case WonderType.tajMahal:
|
|
||||||
return '${ImagePaths.root}/taj_mahal';
|
|
||||||
case WonderType.christRedeemer:
|
|
||||||
return '${ImagePaths.root}/christ_the_redeemer';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String get homeBtn => '$assetPath/wonder-button.png';
|
String get homeBtn => '$assetPath/wonder-button.png';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/// Consolidate imports that are common across the app.
|
/// Consolidate imports that are common across the app.
|
||||||
|
library;
|
||||||
|
|
||||||
export 'dart:math';
|
export 'dart:math';
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:desktop_window/desktop_window.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
@ -34,10 +33,6 @@ class AppLogic {
|
|||||||
/// Loads settings, sets up services etc.
|
/// Loads settings, sets up services etc.
|
||||||
Future<void> bootstrap() async {
|
Future<void> bootstrap() async {
|
||||||
debugPrint('bootstrap start...');
|
debugPrint('bootstrap start...');
|
||||||
// Set min-sizes for desktop apps
|
|
||||||
if (PlatformInfo.isDesktop) {
|
|
||||||
await DesktopWindow.setMinWindowSize($styles.sizes.minAppSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
// SB: This is intentionally not a debugPrint, as it's a message for users who open the console on web.
|
// SB: This is intentionally not a debugPrint, as it's a message for users who open the console on web.
|
||||||
|
@ -40,7 +40,7 @@ class CollectiblesLogic with ThrottledSaveLoadMixin {
|
|||||||
statesById.value = states;
|
statesById.value = states;
|
||||||
if (state == CollectibleState.discovered) {
|
if (state == CollectibleState.discovered) {
|
||||||
final data = fromId(id)!;
|
final data = fromId(id)!;
|
||||||
_updateNativeWidgetTextData(
|
_updateNativeHomeWidgetData(
|
||||||
title: data.title,
|
title: data.title,
|
||||||
id: data.id,
|
id: data.id,
|
||||||
imageUrl: data.imageUrlSmall,
|
imageUrl: data.imageUrlSmall,
|
||||||
@ -91,15 +91,14 @@ class CollectiblesLogic with ThrottledSaveLoadMixin {
|
|||||||
for (int i = 0; i < all.length; i++) {
|
for (int i = 0; i < all.length; i++) {
|
||||||
states[all[i].id] = CollectibleState.lost;
|
states[all[i].id] = CollectibleState.lost;
|
||||||
}
|
}
|
||||||
if (_nativeWidget.isSupported) {
|
_updateNativeHomeWidgetData(); // clear home widget data
|
||||||
_updateNativeWidgetTextData(); // clear home widget data
|
|
||||||
}
|
|
||||||
statesById.value = states;
|
statesById.value = states;
|
||||||
debugPrint('collection reset');
|
debugPrint('collection reset');
|
||||||
scheduleSave();
|
scheduleSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _updateNativeWidgetTextData({String title = '', String id = '', String imageUrl = ''}) async {
|
Future<void> _updateNativeHomeWidgetData({String title = '', String id = '', String imageUrl = ''}) async {
|
||||||
|
if (!_nativeWidget.isSupported) return;
|
||||||
// Save title
|
// Save title
|
||||||
await _nativeWidget.save<String>('lastDiscoveredTitle', title);
|
await _nativeWidget.save<String>('lastDiscoveredTitle', title);
|
||||||
// Subtitle
|
// Subtitle
|
||||||
@ -115,7 +114,7 @@ class CollectiblesLogic with ThrottledSaveLoadMixin {
|
|||||||
if (imageUrl.isNotEmpty) {
|
if (imageUrl.isNotEmpty) {
|
||||||
var bytes = await http.readBytes(Uri.parse(imageUrl));
|
var bytes = await http.readBytes(Uri.parse(imageUrl));
|
||||||
imageBase64 = base64Encode(bytes);
|
imageBase64 = base64Encode(bytes);
|
||||||
debugPrint('Saving base64 bytes: $imageBase64');
|
debugPrint('Saving base64 bytes for homeWidget');
|
||||||
}
|
}
|
||||||
await _nativeWidget.save<String>('lastDiscoveredImageData', imageBase64);
|
await _nativeWidget.save<String>('lastDiscoveredImageData', imageBase64);
|
||||||
await _nativeWidget.markDirty();
|
await _nativeWidget.markDirty();
|
||||||
|
@ -14,18 +14,11 @@ class UnsplashPhotoData {
|
|||||||
String getUnsplashUrl(int size) => '$url?q=90&fm=jpg&w=$size&fit=max';
|
String getUnsplashUrl(int size) => '$url?q=90&fm=jpg&w=$size&fit=max';
|
||||||
|
|
||||||
static String getSelfHostedUrl(String id, UnsplashPhotoSize targetSize) {
|
static String getSelfHostedUrl(String id, UnsplashPhotoSize targetSize) {
|
||||||
late int size;
|
int size = switch (targetSize) {
|
||||||
switch (targetSize) {
|
UnsplashPhotoSize.med => 400,
|
||||||
case UnsplashPhotoSize.med:
|
UnsplashPhotoSize.large => 800,
|
||||||
size = 400;
|
UnsplashPhotoSize.xl => 1200
|
||||||
break;
|
};
|
||||||
case UnsplashPhotoSize.large:
|
|
||||||
size = 800;
|
|
||||||
break;
|
|
||||||
case UnsplashPhotoSize.xl:
|
|
||||||
size = 1200;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (PlatformInfo.pixelRatio >= 1.5 || PlatformInfo.isDesktop) {
|
if (PlatformInfo.pixelRatio >= 1.5 || PlatformInfo.isDesktop) {
|
||||||
size *= 2;
|
size *= 2;
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,4 @@ class UnsplashLogic {
|
|||||||
UnsplashService get service => GetIt.I.get<UnsplashService>();
|
UnsplashService get service => GetIt.I.get<UnsplashService>();
|
||||||
|
|
||||||
List<String>? getCollectionPhotos(String collectionId) => _idsByCollection[collectionId];
|
List<String>? getCollectionPhotos(String collectionId) => _idsByCollection[collectionId];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ void main() async {
|
|||||||
|
|
||||||
/// Creates an app using the [MaterialApp.router] constructor and the global `appRouter`, an instance of [GoRouter].
|
/// Creates an app using the [MaterialApp.router] constructor and the global `appRouter`, an instance of [GoRouter].
|
||||||
class WondersApp extends StatelessWidget with GetItMixin {
|
class WondersApp extends StatelessWidget with GetItMixin {
|
||||||
WondersApp({Key? key}) : super(key: key);
|
WondersApp({super.key});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final locale = watchX((SettingsLogic s) => s.currentLocale);
|
final locale = watchX((SettingsLogic s) => s.currentLocale);
|
||||||
@ -42,6 +42,7 @@ class WondersApp extends StatelessWidget with GetItMixin {
|
|||||||
routerDelegate: appRouter.routerDelegate,
|
routerDelegate: appRouter.routerDelegate,
|
||||||
shortcuts: AppShortcuts.defaults,
|
shortcuts: AppShortcuts.defaults,
|
||||||
theme: ThemeData(fontFamily: $styles.text.body.fontFamily, useMaterial3: true),
|
theme: ThemeData(fontFamily: $styles.text.body.fontFamily, useMaterial3: true),
|
||||||
|
color: $styles.colors.black,
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
AppLocalizations.delegate,
|
AppLocalizations.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
@ -13,6 +13,9 @@ class AppColors {
|
|||||||
final Color greyStrong = const Color(0xFF272625);
|
final Color greyStrong = const Color(0xFF272625);
|
||||||
final Color greyMedium = const Color(0xFF9D9995);
|
final Color greyMedium = const Color(0xFF9D9995);
|
||||||
final Color white = Colors.white;
|
final Color white = Colors.white;
|
||||||
|
// NOTE: If this color is changed, also change it in
|
||||||
|
// - web/manifest.json
|
||||||
|
// - web/index.html -
|
||||||
final Color black = const Color(0xFF1E1B18);
|
final Color black = const Color(0xFF1E1B18);
|
||||||
|
|
||||||
final bool isDark = false;
|
final bool isDark = false;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
// ignore_for_file: library_private_types_in_public_api
|
// ignore_for_file: library_private_types_in_public_api
|
||||||
|
|
||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
export 'colors.dart';
|
export 'colors.dart';
|
||||||
@ -16,20 +14,13 @@ class AppStyle {
|
|||||||
final shortestSide = screenSize.shortestSide;
|
final shortestSide = screenSize.shortestSide;
|
||||||
const tabletXl = 1000;
|
const tabletXl = 1000;
|
||||||
const tabletLg = 800;
|
const tabletLg = 800;
|
||||||
const tabletSm = 600;
|
|
||||||
const phoneLg = 400;
|
|
||||||
if (shortestSide > tabletXl) {
|
if (shortestSide > tabletXl) {
|
||||||
scale = 1.25;
|
scale = 1.2;
|
||||||
} else if (shortestSide > tabletLg) {
|
} else if (shortestSide > tabletLg) {
|
||||||
scale = 1.15;
|
scale = 1.1;
|
||||||
} else if (shortestSide > tabletSm) {
|
|
||||||
scale = 1;
|
|
||||||
} else if (shortestSide > phoneLg) {
|
|
||||||
scale = .9; // phone
|
|
||||||
} else {
|
} else {
|
||||||
scale = .85; // small phone
|
scale = 1;
|
||||||
}
|
}
|
||||||
//debugPrint('screenSize=$screenSize, scale=$scale');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
late final double scale;
|
late final double scale;
|
||||||
|
@ -2,45 +2,29 @@ import 'package:wonders/common_libs.dart';
|
|||||||
|
|
||||||
extension WonderColorExtensions on WonderType {
|
extension WonderColorExtensions on WonderType {
|
||||||
Color get bgColor {
|
Color get bgColor {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case WonderType.pyramidsGiza:
|
WonderType.pyramidsGiza => const Color(0xFF16184D),
|
||||||
return const Color(0xFF16184D);
|
WonderType.greatWall => const Color(0xFF642828),
|
||||||
case WonderType.greatWall:
|
WonderType.petra => const Color(0xFF444B9B),
|
||||||
return const Color(0xFF642828);
|
WonderType.colosseum => const Color(0xFF1E736D),
|
||||||
case WonderType.petra:
|
WonderType.chichenItza => const Color(0xFF164F2A),
|
||||||
return const Color(0xFF444B9B);
|
WonderType.machuPicchu => const Color(0xFF0E4064),
|
||||||
case WonderType.colosseum:
|
WonderType.tajMahal => const Color(0xFFC96454),
|
||||||
return const Color(0xFF1E736D);
|
WonderType.christRedeemer => const Color(0xFF1C4D46)
|
||||||
case WonderType.chichenItza:
|
};
|
||||||
return const Color(0xFF164F2A);
|
|
||||||
case WonderType.machuPicchu:
|
|
||||||
return const Color(0xFF0E4064);
|
|
||||||
case WonderType.tajMahal:
|
|
||||||
return const Color(0xFFC96454);
|
|
||||||
case WonderType.christRedeemer:
|
|
||||||
return const Color(0xFF1C4D46);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Color get fgColor {
|
Color get fgColor {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case WonderType.pyramidsGiza:
|
WonderType.pyramidsGiza => const Color(0xFF444B9B),
|
||||||
return const Color(0xFF444B9B);
|
WonderType.greatWall => const Color(0xFF688750),
|
||||||
case WonderType.greatWall:
|
WonderType.petra => const Color(0xFF1B1A65),
|
||||||
return const Color(0xFF688750);
|
WonderType.colosseum => const Color(0xFF4AA39D),
|
||||||
case WonderType.petra:
|
WonderType.chichenItza => const Color(0xFFE2CFBB),
|
||||||
return const Color(0xFF1B1A65);
|
WonderType.machuPicchu => const Color(0xFFC1D9D1),
|
||||||
case WonderType.colosseum:
|
WonderType.tajMahal => const Color(0xFF642828),
|
||||||
return const Color(0xFF4AA39D);
|
WonderType.christRedeemer => const Color(0xFFED7967)
|
||||||
case WonderType.chichenItza:
|
};
|
||||||
return const Color(0xFFE2CFBB);
|
|
||||||
case WonderType.machuPicchu:
|
|
||||||
return const Color(0xFFC1D9D1);
|
|
||||||
case WonderType.tajMahal:
|
|
||||||
return const Color(0xFF642828);
|
|
||||||
case WonderType.christRedeemer:
|
|
||||||
return const Color(0xFFED7967);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import 'package:wonders/common_libs.dart';
|
|||||||
import 'package:wonders/ui/common/app_scroll_behavior.dart';
|
import 'package:wonders/ui/common/app_scroll_behavior.dart';
|
||||||
|
|
||||||
class WondersAppScaffold extends StatelessWidget {
|
class WondersAppScaffold extends StatelessWidget {
|
||||||
const WondersAppScaffold({Key? key, required this.child}) : super(key: key);
|
const WondersAppScaffold({super.key, required this.child});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
static AppStyle get style => _style;
|
static AppStyle get style => _style;
|
||||||
static AppStyle _style = AppStyle();
|
static AppStyle _style = AppStyle();
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class AppBackdrop extends StatelessWidget {
|
class AppBackdrop extends StatelessWidget {
|
||||||
const AppBackdrop({
|
const AppBackdrop({
|
||||||
Key? key,
|
super.key,
|
||||||
this.strength = 1,
|
this.strength = 1,
|
||||||
this.child,
|
this.child,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final double strength;
|
final double strength;
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class AppIcon extends StatelessWidget {
|
class AppIcon extends StatelessWidget {
|
||||||
const AppIcon(this.icon, {Key? key, this.size = 22, this.color}) : super(key: key);
|
const AppIcon(this.icon, {super.key, this.size = 22, this.color});
|
||||||
final AppIcons icon;
|
final AppIcons icon;
|
||||||
final double size;
|
final double size;
|
||||||
final Color? color;
|
final Color? color;
|
||||||
|
@ -34,14 +34,11 @@ class AppShortcuts {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static Map<ShortcutActivator, Intent>? get defaults {
|
static Map<ShortcutActivator, Intent>? get defaults {
|
||||||
switch (defaultTargetPlatform) {
|
return switch (defaultTargetPlatform) {
|
||||||
// fall back to default shortcuts for ios and android
|
// fall back to default shortcuts for ios and android
|
||||||
case TargetPlatform.iOS:
|
TargetPlatform.iOS || TargetPlatform.android => null,
|
||||||
case TargetPlatform.android:
|
|
||||||
return null;
|
|
||||||
// unify shortcuts for desktop/web
|
// unify shortcuts for desktop/web
|
||||||
default:
|
_ => _defaultWebAndDesktopShortcuts
|
||||||
return _defaultWebAndDesktopShortcuts;
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,7 @@ class BlendMask extends SingleChildRenderObjectWidget {
|
|||||||
final List<BlendMode> blendModes;
|
final List<BlendMode> blendModes;
|
||||||
final double opacity;
|
final double opacity;
|
||||||
|
|
||||||
const BlendMask({required this.blendModes, this.opacity = 1.0, Key? key, required Widget child})
|
const BlendMask({required this.blendModes, this.opacity = 1.0, super.key, required Widget super.child});
|
||||||
: super(key: key, child: child);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RenderObject createRenderObject(context) => RenderBlendMask(blendModes, opacity);
|
RenderObject createRenderObject(context) => RenderBlendMask(blendModes, opacity);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class CenteredBox extends StatelessWidget {
|
class CenteredBox extends StatelessWidget {
|
||||||
const CenteredBox({Key? key, required this.child, this.width, this.height, this.padding}) : super(key: key);
|
const CenteredBox({super.key, required this.child, this.width, this.height, this.padding});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final double? width;
|
final double? width;
|
||||||
final double? height;
|
final double? height;
|
||||||
|
@ -6,7 +6,7 @@ import 'package:wonders/ui/common/utils/app_haptics.dart';
|
|||||||
import 'package:wonders/ui/screens/collectible_found/collectible_found_screen.dart';
|
import 'package:wonders/ui/screens/collectible_found/collectible_found_screen.dart';
|
||||||
|
|
||||||
class CollectibleItem extends StatelessWidget with GetItMixin {
|
class CollectibleItem extends StatelessWidget with GetItMixin {
|
||||||
CollectibleItem(this.collectible, {this.size = 64.0, Key? key, this.focus}) : super(key: key) {
|
CollectibleItem(this.collectible, {this.size = 64.0, super.key, this.focus}) {
|
||||||
// pre-fetch the image, so it's ready if we show the collectible found screen.
|
// pre-fetch the image, so it's ready if we show the collectible found screen.
|
||||||
_imageProvider = NetworkImage(collectible.imageUrl);
|
_imageProvider = NetworkImage(collectible.imageUrl);
|
||||||
_imageProvider.resolve(ImageConfiguration()).addListener(ImageStreamListener((_, __) {}));
|
_imageProvider.resolve(ImageConfiguration()).addListener(ImageStreamListener((_, __) {}));
|
||||||
@ -56,9 +56,9 @@ class CollectibleItem extends StatelessWidget with GetItMixin {
|
|||||||
.animate(onPlay: (controller) => controller.repeat())
|
.animate(onPlay: (controller) => controller.repeat())
|
||||||
.shimmer(delay: 4000.ms, duration: $styles.times.med * 3)
|
.shimmer(delay: 4000.ms, duration: $styles.times.med * 3)
|
||||||
.shake(curve: Curves.easeInOutCubic, hz: 4)
|
.shake(curve: Curves.easeInOutCubic, hz: 4)
|
||||||
.scale(begin: 1.0, end: 1.1, duration: $styles.times.med)
|
.scale(begin: Offset(1.0, 1.0), end: Offset(1.1, 1.1), duration: $styles.times.med)
|
||||||
.then(delay: $styles.times.med)
|
.then(delay: $styles.times.med)
|
||||||
.scale(begin: 1.0, end: 1 / 1.1),
|
.scale(begin: Offset(1.0, 1.0), end: Offset(1 / 1.1, 1 / 1.1)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -2,8 +2,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class CompassDivider extends StatelessWidget {
|
class CompassDivider extends StatelessWidget {
|
||||||
const CompassDivider({Key? key, required this.isExpanded, this.duration, this.linesColor, this.compassColor})
|
const CompassDivider({super.key, required this.isExpanded, this.duration, this.linesColor, this.compassColor});
|
||||||
: super(key: key);
|
|
||||||
final bool isExpanded;
|
final bool isExpanded;
|
||||||
final Duration? duration;
|
final Duration? duration;
|
||||||
final Color? linesColor;
|
final Color? linesColor;
|
||||||
|
@ -3,7 +3,7 @@ import 'package:wonders/ui/common/app_icons.dart';
|
|||||||
|
|
||||||
class AppHeader extends StatelessWidget {
|
class AppHeader extends StatelessWidget {
|
||||||
const AppHeader(
|
const AppHeader(
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.title,
|
this.title,
|
||||||
this.subtitle,
|
this.subtitle,
|
||||||
this.showBackBtn = true,
|
this.showBackBtn = true,
|
||||||
@ -11,8 +11,7 @@ class AppHeader extends StatelessWidget {
|
|||||||
this.onBack,
|
this.onBack,
|
||||||
this.trailing,
|
this.trailing,
|
||||||
this.backIcon = AppIcons.prev,
|
this.backIcon = AppIcons.prev,
|
||||||
this.backBtnSemantics})
|
this.backBtnSemantics});
|
||||||
: super(key: key);
|
|
||||||
final String? title;
|
final String? title;
|
||||||
final String? subtitle;
|
final String? subtitle;
|
||||||
final bool showBackBtn;
|
final bool showBackBtn;
|
||||||
|
@ -6,7 +6,7 @@ import 'package:wonders/ui/common/controls/app_loading_indicator.dart';
|
|||||||
|
|
||||||
class AppImage extends StatefulWidget {
|
class AppImage extends StatefulWidget {
|
||||||
const AppImage({
|
const AppImage({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.image,
|
required this.image,
|
||||||
this.fit = BoxFit.scaleDown,
|
this.fit = BoxFit.scaleDown,
|
||||||
this.alignment = Alignment.center,
|
this.alignment = Alignment.center,
|
||||||
@ -16,7 +16,7 @@ class AppImage extends StatefulWidget {
|
|||||||
this.progress = false,
|
this.progress = false,
|
||||||
this.color,
|
this.color,
|
||||||
this.scale,
|
this.scale,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final ImageProvider? image;
|
final ImageProvider? image;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
@ -88,7 +88,9 @@ class _AppImageState extends State<AppImage> {
|
|||||||
|
|
||||||
ImageProvider? _capImageSize(ImageProvider? image) {
|
ImageProvider? _capImageSize(ImageProvider? image) {
|
||||||
// Disable resizing for web as it is currently single-threaded and causes the UI to lock up when resizing large images
|
// Disable resizing for web as it is currently single-threaded and causes the UI to lock up when resizing large images
|
||||||
if (kIsWeb) return image; // TODO: Remove this when the web engine is updated to support non-blocking image resizing
|
if (kIsWeb) {
|
||||||
|
return image; // TODO: Remove this when the web engine is updated to support non-blocking image resizing
|
||||||
|
}
|
||||||
if (image == null || widget.scale == null) return image;
|
if (image == null || widget.scale == null) return image;
|
||||||
final MediaQueryData mq = MediaQuery.of(context);
|
final MediaQueryData mq = MediaQuery.of(context);
|
||||||
final Size screenSize = mq.size * mq.devicePixelRatio * widget.scale!;
|
final Size screenSize = mq.size * mq.devicePixelRatio * widget.scale!;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class AppLoadingIndicator extends StatelessWidget {
|
class AppLoadingIndicator extends StatelessWidget {
|
||||||
const AppLoadingIndicator({Key? key, this.value, this.color}) : super(key: key);
|
const AppLoadingIndicator({super.key, this.value, this.color});
|
||||||
final Color? color;
|
final Color? color;
|
||||||
final double? value;
|
final double? value;
|
||||||
|
|
||||||
|
@ -3,15 +3,14 @@ import 'package:wonders/common_libs.dart';
|
|||||||
|
|
||||||
class AppPageIndicator extends StatefulWidget {
|
class AppPageIndicator extends StatefulWidget {
|
||||||
AppPageIndicator({
|
AppPageIndicator({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.count,
|
required this.count,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
this.onDotPressed,
|
this.onDotPressed,
|
||||||
this.color,
|
this.color,
|
||||||
this.dotSize,
|
this.dotSize,
|
||||||
String? semanticPageTitle,
|
String? semanticPageTitle,
|
||||||
}) : semanticPageTitle = semanticPageTitle ?? $strings.appPageDefaultTitlePage,
|
}) : semanticPageTitle = semanticPageTitle ?? $strings.appPageDefaultTitlePage;
|
||||||
super(key: key);
|
|
||||||
final int count;
|
final int count;
|
||||||
final PageController controller;
|
final PageController controller;
|
||||||
final void Function(int index)? onDotPressed;
|
final void Function(int index)? onDotPressed;
|
||||||
|
@ -9,7 +9,7 @@ Widget _buildIcon(BuildContext context, AppIcons icon, {required bool isSecondar
|
|||||||
class AppBtn extends StatelessWidget {
|
class AppBtn extends StatelessWidget {
|
||||||
// ignore: prefer_const_constructors_in_immutables
|
// ignore: prefer_const_constructors_in_immutables
|
||||||
AppBtn({
|
AppBtn({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.semanticLabel,
|
required this.semanticLabel,
|
||||||
this.enableFeedback = true,
|
this.enableFeedback = true,
|
||||||
@ -24,11 +24,10 @@ class AppBtn extends StatelessWidget {
|
|||||||
this.border,
|
this.border,
|
||||||
this.focusNode,
|
this.focusNode,
|
||||||
this.onFocusChanged,
|
this.onFocusChanged,
|
||||||
}) : _builder = null,
|
}) : _builder = null;
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
AppBtn.from({
|
AppBtn.from({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.enableFeedback = true,
|
this.enableFeedback = true,
|
||||||
this.pressEffect = true,
|
this.pressEffect = true,
|
||||||
@ -45,9 +44,10 @@ class AppBtn extends StatelessWidget {
|
|||||||
AppIcons? icon,
|
AppIcons? icon,
|
||||||
double? iconSize,
|
double? iconSize,
|
||||||
}) : child = null,
|
}) : child = null,
|
||||||
circular = false,
|
circular = false {
|
||||||
super(key: key) {
|
if (semanticLabel == null && text == null) {
|
||||||
if (semanticLabel == null && text == null) throw ('AppBtn.from must include either text or semanticLabel');
|
throw ('AppBtn.from must include either text or semanticLabel');
|
||||||
|
}
|
||||||
this.semanticLabel = semanticLabel ?? text ?? '';
|
this.semanticLabel = semanticLabel ?? text ?? '';
|
||||||
_builder = (context) {
|
_builder = (context) {
|
||||||
if (text == null && icon == null) return SizedBox.shrink();
|
if (text == null && icon == null) return SizedBox.shrink();
|
||||||
@ -70,7 +70,7 @@ class AppBtn extends StatelessWidget {
|
|||||||
|
|
||||||
// ignore: prefer_const_constructors_in_immutables
|
// ignore: prefer_const_constructors_in_immutables
|
||||||
AppBtn.basic({
|
AppBtn.basic({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.semanticLabel,
|
required this.semanticLabel,
|
||||||
this.enableFeedback = true,
|
this.enableFeedback = true,
|
||||||
@ -85,8 +85,7 @@ class AppBtn extends StatelessWidget {
|
|||||||
}) : expand = false,
|
}) : expand = false,
|
||||||
bgColor = Colors.transparent,
|
bgColor = Colors.transparent,
|
||||||
border = null,
|
border = null,
|
||||||
_builder = null,
|
_builder = null;
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
// interaction:
|
// interaction:
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
@ -185,7 +184,7 @@ class AppBtn extends StatelessWidget {
|
|||||||
/// Add a transparency-based press effect to buttons.
|
/// Add a transparency-based press effect to buttons.
|
||||||
/// //////////////////////////////////////////////////
|
/// //////////////////////////////////////////////////
|
||||||
class _ButtonPressEffect extends StatefulWidget {
|
class _ButtonPressEffect extends StatefulWidget {
|
||||||
const _ButtonPressEffect(this.child, {Key? key}) : super(key: key);
|
const _ButtonPressEffect(this.child);
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -212,7 +211,7 @@ class _ButtonPressEffectState extends State<_ButtonPressEffect> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _CustomFocusBuilder extends StatefulWidget {
|
class _CustomFocusBuilder extends StatefulWidget {
|
||||||
const _CustomFocusBuilder({Key? key, required this.builder, this.focusNode, this.onFocusChanged}) : super(key: key);
|
const _CustomFocusBuilder({required this.builder, this.focusNode, this.onFocusChanged});
|
||||||
final Widget Function(BuildContext context, FocusNode focus) builder;
|
final Widget Function(BuildContext context, FocusNode focus) builder;
|
||||||
final void Function(bool hasFocus)? onFocusChanged;
|
final void Function(bool hasFocus)? onFocusChanged;
|
||||||
final FocusNode? focusNode;
|
final FocusNode? focusNode;
|
||||||
|
@ -2,8 +2,7 @@ import 'package:wonders/common_libs.dart';
|
|||||||
import 'package:wonders/ui/common/utils/app_haptics.dart';
|
import 'package:wonders/ui/common/utils/app_haptics.dart';
|
||||||
|
|
||||||
class SimpleCheckbox extends StatelessWidget {
|
class SimpleCheckbox extends StatelessWidget {
|
||||||
const SimpleCheckbox({Key? key, required this.active, required this.onToggled, required this.label})
|
const SimpleCheckbox({super.key, required this.active, required this.onToggled, required this.label});
|
||||||
: super(key: key);
|
|
||||||
final bool active;
|
final bool active;
|
||||||
final String label;
|
final String label;
|
||||||
final Function(bool? onToggle) onToggled;
|
final Function(bool? onToggle) onToggled;
|
||||||
|
@ -4,14 +4,14 @@ import 'package:wonders/ui/common/fullscreen_keyboard_listener.dart';
|
|||||||
|
|
||||||
class CircleBtn extends StatelessWidget {
|
class CircleBtn extends StatelessWidget {
|
||||||
const CircleBtn({
|
const CircleBtn({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.child,
|
required this.child,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.border,
|
this.border,
|
||||||
this.bgColor,
|
this.bgColor,
|
||||||
this.size,
|
this.size,
|
||||||
required this.semanticLabel,
|
required this.semanticLabel,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
static double defaultSize = 48;
|
static double defaultSize = 48;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ class CircleBtn extends StatelessWidget {
|
|||||||
|
|
||||||
class CircleIconBtn extends StatelessWidget {
|
class CircleIconBtn extends StatelessWidget {
|
||||||
const CircleIconBtn({
|
const CircleIconBtn({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.border,
|
this.border,
|
||||||
@ -50,7 +50,7 @@ class CircleIconBtn extends StatelessWidget {
|
|||||||
this.iconSize,
|
this.iconSize,
|
||||||
this.flipIcon = false,
|
this.flipIcon = false,
|
||||||
required this.semanticLabel,
|
required this.semanticLabel,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
//TODO: Reduce size if design re-exports icon-images without padding
|
//TODO: Reduce size if design re-exports icon-images without padding
|
||||||
static double defaultSize = 28;
|
static double defaultSize = 28;
|
||||||
@ -87,13 +87,13 @@ class CircleIconBtn extends StatelessWidget {
|
|||||||
|
|
||||||
class BackBtn extends StatelessWidget {
|
class BackBtn extends StatelessWidget {
|
||||||
const BackBtn({
|
const BackBtn({
|
||||||
Key? key,
|
super.key,
|
||||||
this.icon = AppIcons.prev,
|
this.icon = AppIcons.prev,
|
||||||
this.onPressed,
|
this.onPressed,
|
||||||
this.semanticLabel,
|
this.semanticLabel,
|
||||||
this.bgColor,
|
this.bgColor,
|
||||||
this.iconColor,
|
this.iconColor,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final Color? bgColor;
|
final Color? bgColor;
|
||||||
final Color? iconColor;
|
final Color? iconColor;
|
||||||
@ -121,20 +121,23 @@ class BackBtn extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return FullscreenKeyboardListener(
|
return FullscreenKeyboardListener(
|
||||||
onKeyDown: (event) => _handleKeyDown(context, event), child: CircleIconBtn(
|
onKeyDown: (event) => _handleKeyDown(context, event),
|
||||||
|
child: CircleIconBtn(
|
||||||
icon: icon,
|
icon: icon,
|
||||||
bgColor: bgColor,
|
bgColor: bgColor,
|
||||||
color: iconColor,
|
color: iconColor,
|
||||||
onPressed: onPressed ?? () {
|
onPressed: onPressed ??
|
||||||
|
() {
|
||||||
final nav = Navigator.of(context);
|
final nav = Navigator.of(context);
|
||||||
if(nav.canPop()){
|
if (nav.canPop()) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
} else {
|
} else {
|
||||||
context.go(ScreenPaths.home);
|
context.go(ScreenPaths.home);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
semanticLabel: semanticLabel ?? $strings.circleButtonsSemanticBack,
|
semanticLabel: semanticLabel ?? $strings.circleButtonsSemanticBack,
|
||||||
),);
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget safe() => _SafeAreaWithPadding(child: this);
|
Widget safe() => _SafeAreaWithPadding(child: this);
|
||||||
@ -153,7 +156,7 @@ class BackBtn extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SafeAreaWithPadding extends StatelessWidget {
|
class _SafeAreaWithPadding extends StatelessWidget {
|
||||||
const _SafeAreaWithPadding({Key? key, required this.child}) : super(key: key);
|
const _SafeAreaWithPadding({required this.child});
|
||||||
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import 'package:wonders/common_libs.dart';
|
|||||||
import 'package:wonders/ui/common/static_text_scale.dart';
|
import 'package:wonders/ui/common/static_text_scale.dart';
|
||||||
|
|
||||||
class DiagonalTextPageIndicator extends StatelessWidget {
|
class DiagonalTextPageIndicator extends StatelessWidget {
|
||||||
const DiagonalTextPageIndicator({Key? key, required this.current, required this.total}) : super(key: key);
|
const DiagonalTextPageIndicator({super.key, required this.current, required this.total});
|
||||||
final int current;
|
final int current;
|
||||||
final int total;
|
final int total;
|
||||||
static final _fontSize = 26 * $styles.scale;
|
static final _fontSize = 26 * $styles.scale;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class EightWaySwipeDetector extends StatefulWidget {
|
class EightWaySwipeDetector extends StatefulWidget {
|
||||||
const EightWaySwipeDetector({Key? key, required this.child, this.threshold = 50, required this.onSwipe})
|
const EightWaySwipeDetector({super.key, required this.child, this.threshold = 50, required this.onSwipe});
|
||||||
: super(key: key);
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final double threshold;
|
final double threshold;
|
||||||
final void Function(Offset dir)? onSwipe;
|
final void Function(Offset dir)? onSwipe;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class LocaleSwitcher extends StatelessWidget with GetItMixin {
|
class LocaleSwitcher extends StatelessWidget with GetItMixin {
|
||||||
LocaleSwitcher({Key? key}) : super(key: key);
|
LocaleSwitcher({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -11,6 +11,7 @@ class LocaleSwitcher extends StatelessWidget with GetItMixin {
|
|||||||
await settingsLogic.changeLocale(newLocale);
|
await settingsLogic.changeLocale(newLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AppBtn.from(text: $strings.localeSwapButton, onPressed: handleSwapLocale, padding: EdgeInsets.all($styles.insets.sm));
|
return AppBtn.from(
|
||||||
|
text: $strings.localeSwapButton, onPressed: handleSwapLocale, padding: EdgeInsets.all($styles.insets.sm));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,19 +6,19 @@ class ScrollDecorator extends StatefulWidget {
|
|||||||
/// its ScrollController.
|
/// its ScrollController.
|
||||||
// ignore: prefer_const_constructors_in_immutables
|
// ignore: prefer_const_constructors_in_immutables
|
||||||
ScrollDecorator({
|
ScrollDecorator({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.builder,
|
required this.builder,
|
||||||
this.fgBuilder,
|
this.fgBuilder,
|
||||||
this.bgBuilder,
|
this.bgBuilder,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.onInit,
|
this.onInit,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
/// Creates a ScrollDecorator that fades a widget in at the begin or end of the scrolling widget based on the scroll
|
/// Creates a ScrollDecorator that fades a widget in at the begin or end of the scrolling widget based on the scroll
|
||||||
/// position. For example on a vertical list, it would fade in the `begin` widget when the list is not scrolled to the
|
/// position. For example on a vertical list, it would fade in the `begin` widget when the list is not scrolled to the
|
||||||
/// top.
|
/// top.
|
||||||
ScrollDecorator.fade({
|
ScrollDecorator.fade({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.builder,
|
required this.builder,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.onInit,
|
this.onInit,
|
||||||
@ -27,7 +27,7 @@ class ScrollDecorator extends StatefulWidget {
|
|||||||
bool bg = false,
|
bool bg = false,
|
||||||
Axis direction = Axis.vertical,
|
Axis direction = Axis.vertical,
|
||||||
Duration duration = const Duration(milliseconds: 150),
|
Duration duration = const Duration(milliseconds: 150),
|
||||||
}) : super(key: key) {
|
}) {
|
||||||
Flex flexBuilder(controller) {
|
Flex flexBuilder(controller) {
|
||||||
return Flex(
|
return Flex(
|
||||||
direction: direction,
|
direction: direction,
|
||||||
@ -55,12 +55,12 @@ class ScrollDecorator extends StatefulWidget {
|
|||||||
|
|
||||||
/// Creates an ScrollDecorator that adds a shadow to the top of a vertical list when it is scrolled down.
|
/// Creates an ScrollDecorator that adds a shadow to the top of a vertical list when it is scrolled down.
|
||||||
ScrollDecorator.shadow({
|
ScrollDecorator.shadow({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.builder,
|
required this.builder,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.onInit,
|
this.onInit,
|
||||||
Color color = Colors.black54,
|
Color color = Colors.black54,
|
||||||
}) : super(key: key) {
|
}) {
|
||||||
bgBuilder = null;
|
bgBuilder = null;
|
||||||
fgBuilder = (controller) {
|
fgBuilder = (controller) {
|
||||||
final double ratio = controller.hasClients ? min(1, controller.position.extentBefore / 60) : 0;
|
final double ratio = controller.hasClients ? min(1, controller.position.extentBefore / 60) : 0;
|
||||||
|
@ -40,33 +40,29 @@ class ArchPoint {
|
|||||||
|
|
||||||
List<ArchPoint> _getArchPts(Size size, ArchType type) {
|
List<ArchPoint> _getArchPts(Size size, ArchType type) {
|
||||||
double distanceFromTop = size.width / 3;
|
double distanceFromTop = size.width / 3;
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case ArchType.pyramid:
|
ArchType.pyramid => [
|
||||||
return [
|
|
||||||
ArchPoint(Offset(0, size.height)),
|
ArchPoint(Offset(0, size.height)),
|
||||||
ArchPoint(Offset(0, distanceFromTop)),
|
ArchPoint(Offset(0, distanceFromTop)),
|
||||||
ArchPoint(Offset(size.width / 2, 0)),
|
ArchPoint(Offset(size.width / 2, 0)),
|
||||||
ArchPoint(Offset(size.width, distanceFromTop)),
|
ArchPoint(Offset(size.width, distanceFromTop)),
|
||||||
ArchPoint(Offset(size.width, size.height)),
|
ArchPoint(Offset(size.width, size.height)),
|
||||||
];
|
],
|
||||||
case ArchType.spade:
|
ArchType.spade => [
|
||||||
return [
|
|
||||||
ArchPoint(Offset(0, size.height)),
|
ArchPoint(Offset(0, size.height)),
|
||||||
ArchPoint(Offset(0, distanceFromTop)),
|
ArchPoint(Offset(0, distanceFromTop)),
|
||||||
ArchPoint(Offset(size.width / 2, 0), Offset(0, distanceFromTop * .66)),
|
ArchPoint(Offset(size.width / 2, 0), Offset(0, distanceFromTop * .66)),
|
||||||
ArchPoint(Offset(size.width, distanceFromTop), Offset(size.width, distanceFromTop * .66)),
|
ArchPoint(Offset(size.width, distanceFromTop), Offset(size.width, distanceFromTop * .66)),
|
||||||
ArchPoint(Offset(size.width, size.height)),
|
ArchPoint(Offset(size.width, size.height)),
|
||||||
];
|
],
|
||||||
case ArchType.arch:
|
ArchType.arch => [
|
||||||
return [
|
|
||||||
ArchPoint(Offset(0, size.height)),
|
ArchPoint(Offset(0, size.height)),
|
||||||
ArchPoint(Offset(0, size.width / 2)),
|
ArchPoint(Offset(0, size.width / 2)),
|
||||||
ArchPoint(Offset(size.width / 2, 0), Offset(0, 0)),
|
ArchPoint(Offset(size.width / 2, 0), Offset(0, 0)),
|
||||||
ArchPoint(Offset(size.width, size.width / 2), Offset(size.width, 0)),
|
ArchPoint(Offset(size.width, size.width / 2), Offset(size.width, 0)),
|
||||||
ArchPoint(Offset(size.width, size.height)),
|
ArchPoint(Offset(size.width, size.height)),
|
||||||
];
|
],
|
||||||
case ArchType.wideArch:
|
ArchType.wideArch => [
|
||||||
return [
|
|
||||||
ArchPoint(Offset(0, size.height)),
|
ArchPoint(Offset(0, size.height)),
|
||||||
ArchPoint(Offset(0, size.width / 2)),
|
ArchPoint(Offset(0, size.width / 2)),
|
||||||
ArchPoint(Offset(0, distanceFromTop)),
|
ArchPoint(Offset(0, distanceFromTop)),
|
||||||
@ -74,17 +70,16 @@ List<ArchPoint> _getArchPts(Size size, ArchType type) {
|
|||||||
ArchPoint(Offset(size.width, distanceFromTop), Offset(size.width, 0)),
|
ArchPoint(Offset(size.width, distanceFromTop), Offset(size.width, 0)),
|
||||||
ArchPoint(Offset(size.width, size.width / 2)),
|
ArchPoint(Offset(size.width, size.width / 2)),
|
||||||
ArchPoint(Offset(size.width, size.height)),
|
ArchPoint(Offset(size.width, size.height)),
|
||||||
];
|
],
|
||||||
case ArchType.flatPyramid:
|
ArchType.flatPyramid => [
|
||||||
return [
|
|
||||||
ArchPoint(Offset(0, size.height)),
|
ArchPoint(Offset(0, size.height)),
|
||||||
ArchPoint(Offset(0, distanceFromTop)),
|
ArchPoint(Offset(0, distanceFromTop)),
|
||||||
ArchPoint(Offset(size.width * 0.8 / 2, 0)),
|
ArchPoint(Offset(size.width * 0.8 / 2, 0)),
|
||||||
ArchPoint(Offset(size.width * 1.2 / 2, 0)),
|
ArchPoint(Offset(size.width * 1.2 / 2, 0)),
|
||||||
ArchPoint(Offset(size.width, distanceFromTop)),
|
ArchPoint(Offset(size.width, distanceFromTop)),
|
||||||
ArchPoint(Offset(size.width, size.height)),
|
ArchPoint(Offset(size.width, size.height)),
|
||||||
];
|
]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class CurvedTopClipper extends CustomClipper<Path> {
|
class CurvedTopClipper extends CustomClipper<Path> {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class DashedLine extends StatelessWidget {
|
class DashedLine extends StatelessWidget {
|
||||||
const DashedLine({Key? key, this.vertical = false}) : super(key: key);
|
const DashedLine({super.key, this.vertical = false});
|
||||||
final bool vertical;
|
final bool vertical;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -3,7 +3,7 @@ import 'package:wonders/common_libs.dart';
|
|||||||
/// Colored box that can fade in and out, should yield better performance than
|
/// Colored box that can fade in and out, should yield better performance than
|
||||||
/// fading with an additional Opacity layer.
|
/// fading with an additional Opacity layer.
|
||||||
class FadeColorTransition extends StatelessWidget {
|
class FadeColorTransition extends StatelessWidget {
|
||||||
const FadeColorTransition({Key? key, required this.animation, required this.color}) : super(key: key);
|
const FadeColorTransition({super.key, required this.animation, required this.color});
|
||||||
final Animation<double> animation;
|
final Animation<double> animation;
|
||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class GradientContainer extends StatelessWidget {
|
class GradientContainer extends StatelessWidget {
|
||||||
const GradientContainer(this.colors, this.stops,
|
const GradientContainer(this.colors, this.stops,
|
||||||
{Key? key,
|
{super.key,
|
||||||
this.child,
|
this.child,
|
||||||
this.width,
|
this.width,
|
||||||
this.height,
|
this.height,
|
||||||
@ -10,8 +10,7 @@ class GradientContainer extends StatelessWidget {
|
|||||||
this.begin,
|
this.begin,
|
||||||
this.end,
|
this.end,
|
||||||
this.blendMode,
|
this.blendMode,
|
||||||
this.borderRadius})
|
this.borderRadius});
|
||||||
: super(key: key);
|
|
||||||
final List<Color> colors;
|
final List<Color> colors;
|
||||||
final List<double> stops;
|
final List<double> stops;
|
||||||
final double? width;
|
final double? width;
|
||||||
@ -45,41 +44,12 @@ class GradientContainer extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class HzGradient extends GradientContainer {
|
class HzGradient extends GradientContainer {
|
||||||
const HzGradient(List<Color> colors, List<double> stops,
|
const HzGradient(super.colors, super.stops,
|
||||||
{Key? key,
|
{super.key, super.child, super.width, super.height, super.alignment, super.blendMode, super.borderRadius});
|
||||||
Widget? child,
|
|
||||||
double? width,
|
|
||||||
double? height,
|
|
||||||
Alignment? alignment,
|
|
||||||
BlendMode? blendMode,
|
|
||||||
BorderRadius? borderRadius})
|
|
||||||
: super(colors, stops,
|
|
||||||
key: key,
|
|
||||||
child: child,
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
alignment: alignment,
|
|
||||||
blendMode: blendMode,
|
|
||||||
borderRadius: borderRadius);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class VtGradient extends GradientContainer {
|
class VtGradient extends GradientContainer {
|
||||||
const VtGradient(List<Color> colors, List<double> stops,
|
const VtGradient(super.colors, super.stops,
|
||||||
{Key? key,
|
{super.key, super.child, super.width, super.height, super.alignment, super.blendMode, super.borderRadius})
|
||||||
Widget? child,
|
: super(begin: Alignment.topCenter, end: Alignment.bottomCenter);
|
||||||
double? width,
|
|
||||||
double? height,
|
|
||||||
Alignment? alignment,
|
|
||||||
BlendMode? blendMode,
|
|
||||||
BorderRadius? borderRadius})
|
|
||||||
: super(colors, stops,
|
|
||||||
key: key,
|
|
||||||
child: child,
|
|
||||||
width: width,
|
|
||||||
height: height,
|
|
||||||
alignment: alignment,
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
blendMode: blendMode,
|
|
||||||
borderRadius: borderRadius);
|
|
||||||
}
|
}
|
||||||
|
@ -6,9 +6,8 @@ import 'package:wonders/ui/common/collectible_item.dart';
|
|||||||
/// If `wonders` is empty, then the collectible is always shown.
|
/// If `wonders` is empty, then the collectible is always shown.
|
||||||
class HiddenCollectible extends StatelessWidget with GetItMixin {
|
class HiddenCollectible extends StatelessWidget with GetItMixin {
|
||||||
HiddenCollectible(this.currentWonder,
|
HiddenCollectible(this.currentWonder,
|
||||||
{Key? key, required this.index, this.matches = const [], this.size = 64, this.focus})
|
{super.key, required this.index, this.matches = const [], this.size = 64, this.focus})
|
||||||
: assert(index <= 2, 'index should not exceed 2'),
|
: assert(index <= 2, 'index should not exceed 2');
|
||||||
super(key: key);
|
|
||||||
final int index;
|
final int index;
|
||||||
final double size;
|
final double size;
|
||||||
final List<WonderType> matches;
|
final List<WonderType> matches;
|
||||||
|
@ -9,7 +9,7 @@ class ArrowDir {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class KeyboardArrowsListener extends StatefulWidget {
|
class KeyboardArrowsListener extends StatefulWidget {
|
||||||
const KeyboardArrowsListener({Key? key, required this.child, required this.onArrow}) : super(key: key);
|
const KeyboardArrowsListener({super.key, required this.child, required this.onArrow});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final void Function(ArrowDir dir) onArrow;
|
final void Function(ArrowDir dir) onArrow;
|
||||||
@override
|
@override
|
||||||
|
@ -3,13 +3,13 @@ import 'package:flutter/material.dart';
|
|||||||
/// A lazy-loading [IndexedStack] that loads [children] accordingly.
|
/// A lazy-loading [IndexedStack] that loads [children] accordingly.
|
||||||
class LazyIndexedStack extends StatefulWidget {
|
class LazyIndexedStack extends StatefulWidget {
|
||||||
const LazyIndexedStack({
|
const LazyIndexedStack({
|
||||||
Key? key,
|
super.key,
|
||||||
this.alignment = AlignmentDirectional.topStart,
|
this.alignment = AlignmentDirectional.topStart,
|
||||||
this.textDirection,
|
this.textDirection,
|
||||||
this.sizing = StackFit.loose,
|
this.sizing = StackFit.loose,
|
||||||
this.index = 0,
|
this.index = 0,
|
||||||
this.children = const [],
|
this.children = const [],
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final AlignmentGeometry alignment;
|
final AlignmentGeometry alignment;
|
||||||
final TextDirection? textDirection;
|
final TextDirection? textDirection;
|
||||||
@ -39,9 +39,7 @@ class LazyIndexedStackState extends State<LazyIndexedStack> {
|
|||||||
// Mark current index as active
|
// Mark current index as active
|
||||||
_activated[widget.index] = true;
|
_activated[widget.index] = true;
|
||||||
final children = List.generate(_activated.length, (i) {
|
final children = List.generate(_activated.length, (i) {
|
||||||
Widget child = _activated[i] ? widget.children[i] : const SizedBox.shrink();
|
return _activated[i] ? widget.children[i] : const SizedBox.shrink();
|
||||||
bool isSelected = widget.index == i;
|
|
||||||
return ExcludeFocus(excluding: !isSelected, child: child);
|
|
||||||
});
|
});
|
||||||
return IndexedStack(
|
return IndexedStack(
|
||||||
alignment: widget.alignment,
|
alignment: widget.alignment,
|
||||||
|
@ -4,7 +4,7 @@ import 'package:wonders/ui/common/gradient_container.dart';
|
|||||||
/// Used for situations where the list content should blend into a background color.
|
/// Used for situations where the list content should blend into a background color.
|
||||||
/// Can be placed at the top or bottom of a list, using the `flip' option when on the bottom
|
/// Can be placed at the top or bottom of a list, using the `flip' option when on the bottom
|
||||||
class ListOverscollGradient extends StatelessWidget {
|
class ListOverscollGradient extends StatelessWidget {
|
||||||
const ListOverscollGradient({Key? key, this.size = 100, this.color, this.bottomUp = false}) : super(key: key);
|
const ListOverscollGradient({super.key, this.size = 100, this.color, this.bottomUp = false});
|
||||||
final bool bottomUp;
|
final bool bottomUp;
|
||||||
final double size;
|
final double size;
|
||||||
final Color? color;
|
final Color? color;
|
||||||
|
@ -4,7 +4,7 @@ import 'package:flutter/rendering.dart';
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class MeasurableWidget extends SingleChildRenderObjectWidget {
|
class MeasurableWidget extends SingleChildRenderObjectWidget {
|
||||||
const MeasurableWidget({Key? key, required this.onChange, required Widget child}) : super(key: key, child: child);
|
const MeasurableWidget({super.key, required this.onChange, required Widget super.child});
|
||||||
final void Function(Size size) onChange;
|
final void Function(Size size) onChange;
|
||||||
@override
|
@override
|
||||||
RenderObject createRenderObject(BuildContext context) => MeasureSizeRenderObject(onChange);
|
RenderObject createRenderObject(BuildContext context) => MeasureSizeRenderObject(onChange);
|
||||||
|
@ -11,7 +11,7 @@ Future<bool?> showModal(BuildContext context, {required Widget child}) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LoadingModal extends StatelessWidget {
|
class LoadingModal extends StatelessWidget {
|
||||||
const LoadingModal({Key? key, this.title, this.msg, this.child}) : super(key: key);
|
const LoadingModal({super.key, this.title, this.msg, this.child});
|
||||||
final String? title;
|
final String? title;
|
||||||
final String? msg;
|
final String? msg;
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
@ -28,7 +28,7 @@ class LoadingModal extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class OkModal extends StatelessWidget {
|
class OkModal extends StatelessWidget {
|
||||||
const OkModal({Key? key, this.title, this.msg, this.child}) : super(key: key);
|
const OkModal({super.key, this.title, this.msg, this.child});
|
||||||
final String? title;
|
final String? title;
|
||||||
final String? msg;
|
final String? msg;
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
@ -51,7 +51,7 @@ class OkModal extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class OkCancelModal extends StatelessWidget {
|
class OkCancelModal extends StatelessWidget {
|
||||||
const OkCancelModal({Key? key, this.title, this.msg, this.child}) : super(key: key);
|
const OkCancelModal({super.key, this.title, this.msg, this.child});
|
||||||
final String? title;
|
final String? title;
|
||||||
final String? msg;
|
final String? msg;
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
@ -83,7 +83,7 @@ class _BaseContentModal extends StatelessWidget {
|
|||||||
final Widget? child;
|
final Widget? child;
|
||||||
final List<Widget> buttons;
|
final List<Widget> buttons;
|
||||||
|
|
||||||
const _BaseContentModal({Key? key, this.title, this.msg, required this.buttons, this.child}) : super(key: key);
|
const _BaseContentModal({this.title, this.msg, required this.buttons, this.child});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -5,7 +5,7 @@ import 'package:wonders/ui/common/controls/app_header.dart';
|
|||||||
import 'package:wonders/ui/common/google_maps_marker.dart';
|
import 'package:wonders/ui/common/google_maps_marker.dart';
|
||||||
|
|
||||||
class FullscreenMapsViewer extends StatelessWidget {
|
class FullscreenMapsViewer extends StatelessWidget {
|
||||||
FullscreenMapsViewer({Key? key, required this.type}) : super(key: key);
|
FullscreenMapsViewer({super.key, required this.type});
|
||||||
final WonderType type;
|
final WonderType type;
|
||||||
|
|
||||||
WonderData get data => wondersLogic.getData(type);
|
WonderData get data => wondersLogic.getData(type);
|
||||||
|
@ -7,7 +7,7 @@ import 'package:wonders/ui/common/fullscreen_keyboard_listener.dart';
|
|||||||
import 'package:wonders/ui/common/utils/app_haptics.dart';
|
import 'package:wonders/ui/common/utils/app_haptics.dart';
|
||||||
|
|
||||||
class FullscreenUrlImgViewer extends StatefulWidget {
|
class FullscreenUrlImgViewer extends StatefulWidget {
|
||||||
const FullscreenUrlImgViewer({Key? key, required this.urls, this.index = 0}) : super(key: key);
|
const FullscreenUrlImgViewer({super.key, required this.urls, this.index = 0});
|
||||||
final List<String> urls;
|
final List<String> urls;
|
||||||
final int index;
|
final int index;
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class _FullscreenUrlImgViewerState extends State<FullscreenUrlImgViewer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _Viewer extends StatefulWidget {
|
class _Viewer extends StatefulWidget {
|
||||||
const _Viewer(this.url, this.isZoomed, {Key? key}) : super(key: key);
|
const _Viewer(this.url, this.isZoomed);
|
||||||
|
|
||||||
final String url;
|
final String url;
|
||||||
final ValueNotifier<bool> isZoomed;
|
final ValueNotifier<bool> isZoomed;
|
||||||
|
@ -5,7 +5,7 @@ import 'package:wonders/logic/common/platform_info.dart';
|
|||||||
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
|
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
|
||||||
|
|
||||||
class FullscreenVideoViewer extends StatefulWidget {
|
class FullscreenVideoViewer extends StatefulWidget {
|
||||||
const FullscreenVideoViewer({Key? key, required this.id}) : super(key: key);
|
const FullscreenVideoViewer({super.key, required this.id});
|
||||||
final String id;
|
final String id;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -2,7 +2,7 @@ import 'package:webview_flutter/webview_flutter.dart';
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class FullscreenWebView extends StatelessWidget {
|
class FullscreenWebView extends StatelessWidget {
|
||||||
FullscreenWebView(this.url, {Key? key}) : super(key: key);
|
FullscreenWebView(this.url, {super.key});
|
||||||
final String url;
|
final String url;
|
||||||
|
|
||||||
late final controller = WebViewController()
|
late final controller = WebViewController()
|
||||||
|
@ -3,13 +3,12 @@ import 'package:wonders/ui/common/measurable_widget.dart';
|
|||||||
|
|
||||||
class OpeningCard extends StatefulWidget {
|
class OpeningCard extends StatefulWidget {
|
||||||
const OpeningCard(
|
const OpeningCard(
|
||||||
{Key? key,
|
{super.key,
|
||||||
required this.closedBuilder,
|
required this.closedBuilder,
|
||||||
required this.openBuilder,
|
required this.openBuilder,
|
||||||
required this.isOpen,
|
required this.isOpen,
|
||||||
this.background,
|
this.background,
|
||||||
this.padding})
|
this.padding});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
final Widget Function(BuildContext) closedBuilder;
|
final Widget Function(BuildContext) closedBuilder;
|
||||||
final Widget Function(BuildContext) openBuilder;
|
final Widget Function(BuildContext) openBuilder;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class PopNavigatorUnderlay extends StatelessWidget {
|
class PopNavigatorUnderlay extends StatelessWidget {
|
||||||
const PopNavigatorUnderlay({Key? key}) : super(key: key);
|
const PopNavigatorUnderlay({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class PopRouterOnOverScroll extends StatefulWidget {
|
class PopRouterOnOverScroll extends StatefulWidget {
|
||||||
const PopRouterOnOverScroll({Key? key, required this.child, required this.controller}) : super(key: key);
|
const PopRouterOnOverScroll({super.key, required this.child, required this.controller});
|
||||||
final ScrollController controller;
|
final ScrollController controller;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import 'package:wonders/common_libs.dart';
|
|||||||
import 'package:wonders/ui/common/utils/context_utils.dart';
|
import 'package:wonders/ui/common/utils/context_utils.dart';
|
||||||
|
|
||||||
class AnimatedListItem extends StatelessWidget {
|
class AnimatedListItem extends StatelessWidget {
|
||||||
const AnimatedListItem({Key? key, required this.scrollPos, required this.builder}) : super(key: key);
|
const AnimatedListItem({super.key, required this.scrollPos, required this.builder});
|
||||||
final ValueNotifier<double> scrollPos;
|
final ValueNotifier<double> scrollPos;
|
||||||
final Widget Function(BuildContext context, double pctVisible) builder;
|
final Widget Function(BuildContext context, double pctVisible) builder;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class AnimatedListItem extends StatelessWidget {
|
|||||||
/// Takes a scroll position notifier and a child.
|
/// Takes a scroll position notifier and a child.
|
||||||
/// Scales its child as it scrolls onto screen for a nice effect.
|
/// Scales its child as it scrolls onto screen for a nice effect.
|
||||||
class ScalingListItem extends StatelessWidget {
|
class ScalingListItem extends StatelessWidget {
|
||||||
const ScalingListItem({Key? key, required this.scrollPos, required this.child}) : super(key: key);
|
const ScalingListItem({super.key, required this.scrollPos, required this.child});
|
||||||
final ValueNotifier<double> scrollPos;
|
final ValueNotifier<double> scrollPos;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ import 'package:wonders/common_libs.dart';
|
|||||||
///
|
///
|
||||||
class StackedPageViewBuilder extends StatefulWidget {
|
class StackedPageViewBuilder extends StatefulWidget {
|
||||||
const StackedPageViewBuilder({
|
const StackedPageViewBuilder({
|
||||||
Key? key,
|
super.key,
|
||||||
this.initialIndex = 0,
|
this.initialIndex = 0,
|
||||||
required this.pageCount,
|
required this.pageCount,
|
||||||
required this.builder,
|
required this.builder,
|
||||||
this.onInit,
|
this.onInit,
|
||||||
}) : super(key: key);
|
});
|
||||||
final int initialIndex;
|
final int initialIndex;
|
||||||
final int pageCount;
|
final int pageCount;
|
||||||
final Widget Function(BuildContext builder, PageController controller, PageController follower) builder;
|
final Widget Function(BuildContext builder, PageController controller, PageController follower) builder;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class StaticTextScale extends StatelessWidget {
|
class StaticTextScale extends StatelessWidget {
|
||||||
const StaticTextScale({Key? key, required this.child, this.scale = 1}) : super(key: key);
|
const StaticTextScale({super.key, required this.child, this.scale = 1});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final double scale;
|
final double scale;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:wonders/common_libs.dart';
|
import 'package:wonders/common_libs.dart';
|
||||||
|
|
||||||
class DefaultTextColor extends StatelessWidget {
|
class DefaultTextColor extends StatelessWidget {
|
||||||
const DefaultTextColor({Key? key, required this.color, required this.child}) : super(key: key);
|
const DefaultTextColor({super.key, required this.color, required this.child});
|
||||||
final Color color;
|
final Color color;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ class DefaultTextColor extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LightText extends StatelessWidget {
|
class LightText extends StatelessWidget {
|
||||||
const LightText({Key? key, required this.child}) : super(key: key);
|
const LightText({super.key, required this.child});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -26,7 +26,7 @@ class LightText extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DarkText extends StatelessWidget {
|
class DarkText extends StatelessWidget {
|
||||||
const DarkText({Key? key, required this.child}) : super(key: key);
|
const DarkText({super.key, required this.child});
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -3,15 +3,14 @@ import 'package:wonders/logic/common/string_utils.dart';
|
|||||||
import 'package:wonders/ui/common/themed_text.dart';
|
import 'package:wonders/ui/common/themed_text.dart';
|
||||||
|
|
||||||
class TimelineEventCard extends StatelessWidget {
|
class TimelineEventCard extends StatelessWidget {
|
||||||
const TimelineEventCard({Key? key, required this.year, required this.text, this.darkMode = false}) : super(key: key);
|
const TimelineEventCard({super.key, required this.year, required this.text, this.darkMode = false});
|
||||||
final int year;
|
final int year;
|
||||||
final String text;
|
final String text;
|
||||||
final bool darkMode;
|
final bool darkMode;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Focus(
|
return MergeSemantics(
|
||||||
child: MergeSemantics(
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: $styles.insets.sm),
|
padding: EdgeInsets.only(bottom: $styles.insets.sm),
|
||||||
child: DefaultTextColor(
|
child: DefaultTextColor(
|
||||||
@ -28,8 +27,7 @@ class TimelineEventCard extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('${year.abs()}',
|
Text('${year.abs()}', style: $styles.text.h3.copyWith(fontWeight: FontWeight.w400, height: 1)),
|
||||||
style: $styles.text.h3.copyWith(fontWeight: FontWeight.w400, height: 1)),
|
|
||||||
Text(StringUtils.getYrSuffix(year), style: $styles.text.bodySmall),
|
Text(StringUtils.getYrSuffix(year), style: $styles.text.bodySmall),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -42,7 +40,7 @@ class TimelineEventCard extends StatelessWidget {
|
|||||||
|
|
||||||
/// Text content
|
/// Text content
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(text, style: $styles.text.body),
|
child: Focus(child: Text(text, style: $styles.text.body)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -50,7 +48,6 @@ class TimelineEventCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,7 @@ import 'package:wonders/common_libs.dart';
|
|||||||
import 'package:wonders/logic/data/unsplash_photo_data.dart';
|
import 'package:wonders/logic/data/unsplash_photo_data.dart';
|
||||||
|
|
||||||
class UnsplashPhoto extends StatelessWidget {
|
class UnsplashPhoto extends StatelessWidget {
|
||||||
const UnsplashPhoto(this.id, {Key? key, this.fit = BoxFit.cover, required this.size, this.showCredits = false})
|
const UnsplashPhoto(this.id, {super.key, this.fit = BoxFit.cover, required this.size, this.showCredits = false});
|
||||||
: super(key: key);
|
|
||||||
final String id;
|
final String id;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final UnsplashPhotoSize size;
|
final UnsplashPhotoSize size;
|
||||||
|
@ -6,13 +6,13 @@ import 'package:wonders/logic/data/wonder_data.dart';
|
|||||||
/// Provides a builder, so the visual representation of each track entry can be customized
|
/// Provides a builder, so the visual representation of each track entry can be customized
|
||||||
class WondersTimelineBuilder extends StatelessWidget {
|
class WondersTimelineBuilder extends StatelessWidget {
|
||||||
const WondersTimelineBuilder({
|
const WondersTimelineBuilder({
|
||||||
Key? key,
|
super.key,
|
||||||
this.selectedWonders = const [],
|
this.selectedWonders = const [],
|
||||||
this.timelineBuilder,
|
this.timelineBuilder,
|
||||||
this.axis = Axis.horizontal,
|
this.axis = Axis.horizontal,
|
||||||
this.crossAxisGap,
|
this.crossAxisGap,
|
||||||
this.minSize = 10,
|
this.minSize = 10,
|
||||||
}) : super(key: key);
|
});
|
||||||
final List<WonderType> selectedWonders;
|
final List<WonderType> selectedWonders;
|
||||||
final Widget Function(BuildContext, WonderData type, bool isSelected)? timelineBuilder;
|
final Widget Function(BuildContext, WonderData type, bool isSelected)? timelineBuilder;
|
||||||
final Axis axis;
|
final Axis axis;
|
||||||
@ -96,7 +96,7 @@ class WondersTimelineBuilder extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DefaultTrackEntry extends StatelessWidget {
|
class _DefaultTrackEntry extends StatelessWidget {
|
||||||
const _DefaultTrackEntry({Key? key, required this.isSelected}) : super(key: key);
|
const _DefaultTrackEntry({required this.isSelected});
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -12,7 +12,7 @@ part 'widgets/_bottom_text_content.dart';
|
|||||||
part 'widgets/_collapsing_carousel_item.dart';
|
part 'widgets/_collapsing_carousel_item.dart';
|
||||||
|
|
||||||
class ArtifactCarouselScreen extends StatefulWidget {
|
class ArtifactCarouselScreen extends StatefulWidget {
|
||||||
const ArtifactCarouselScreen({Key? key, required this.type, this.contentPadding = EdgeInsets.zero}) : super(key: key);
|
const ArtifactCarouselScreen({super.key, required this.type, this.contentPadding = EdgeInsets.zero});
|
||||||
final WonderType type;
|
final WonderType type;
|
||||||
final EdgeInsets contentPadding;
|
final EdgeInsets contentPadding;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ part of '../artifact_carousel_screen.dart';
|
|||||||
|
|
||||||
/// Blurry image background for the Artifact Highlights view. Contains horizontal and vertical gradients that stack overtop the blended image.
|
/// Blurry image background for the Artifact Highlights view. Contains horizontal and vertical gradients that stack overtop the blended image.
|
||||||
class _BlurredImageBg extends StatelessWidget {
|
class _BlurredImageBg extends StatelessWidget {
|
||||||
const _BlurredImageBg({Key? key, this.url}) : super(key: key);
|
const _BlurredImageBg({super.key, this.url});
|
||||||
final String? url;
|
final String? url;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -2,8 +2,7 @@ part of '../artifact_carousel_screen.dart';
|
|||||||
|
|
||||||
class _BottomTextContent extends StatelessWidget {
|
class _BottomTextContent extends StatelessWidget {
|
||||||
const _BottomTextContent(
|
const _BottomTextContent(
|
||||||
{Key? key, required this.artifact, required this.height, required this.state, required this.shortMode})
|
{super.key, required this.artifact, required this.height, required this.state, required this.shortMode});
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
final HighlightData artifact;
|
final HighlightData artifact;
|
||||||
final double height;
|
final double height;
|
||||||
|
@ -4,13 +4,12 @@ part of '../artifact_carousel_screen.dart';
|
|||||||
/// This lets the child simply render it's contents
|
/// This lets the child simply render it's contents
|
||||||
class _CollapsingCarouselItem extends StatelessWidget {
|
class _CollapsingCarouselItem extends StatelessWidget {
|
||||||
const _CollapsingCarouselItem(
|
const _CollapsingCarouselItem(
|
||||||
{Key? key,
|
{super.key,
|
||||||
required this.child,
|
required this.child,
|
||||||
required this.indexOffset,
|
required this.indexOffset,
|
||||||
required this.width,
|
required this.width,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
required this.title})
|
required this.title});
|
||||||
: super(key: key);
|
|
||||||
final Widget child;
|
final Widget child;
|
||||||
final int indexOffset;
|
final int indexOffset;
|
||||||
final double width;
|
final double width;
|
||||||
@ -50,11 +49,11 @@ class _CollapsingCarouselItem extends StatelessWidget {
|
|||||||
|
|
||||||
class _AnimatedTranslate extends StatelessWidget {
|
class _AnimatedTranslate extends StatelessWidget {
|
||||||
const _AnimatedTranslate({
|
const _AnimatedTranslate({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.duration,
|
required this.duration,
|
||||||
required this.offset,
|
required this.offset,
|
||||||
required this.child,
|
required this.child,
|
||||||
}) : super(key: key);
|
});
|
||||||
final Duration duration;
|
final Duration duration;
|
||||||
final Offset offset;
|
final Offset offset;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
@ -71,7 +70,7 @@ class _AnimatedTranslate extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DoubleBorderImage extends StatelessWidget {
|
class _DoubleBorderImage extends StatelessWidget {
|
||||||
const _DoubleBorderImage(this.data, {Key? key}) : super(key: key);
|
const _DoubleBorderImage(this.data, {super.key});
|
||||||
final HighlightData data;
|
final HighlightData data;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Container(
|
Widget build(BuildContext context) => Container(
|
||||||
|
@ -10,7 +10,7 @@ part 'widgets/_info_column.dart';
|
|||||||
part 'widgets/_artifact_image_btn.dart';
|
part 'widgets/_artifact_image_btn.dart';
|
||||||
|
|
||||||
class ArtifactDetailsScreen extends StatefulWidget {
|
class ArtifactDetailsScreen extends StatefulWidget {
|
||||||
const ArtifactDetailsScreen({Key? key, required this.artifactId}) : super(key: key);
|
const ArtifactDetailsScreen({super.key, required this.artifactId});
|
||||||
final String artifactId;
|
final String artifactId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../artifact_details_screen.dart';
|
part of '../artifact_details_screen.dart';
|
||||||
|
|
||||||
class _ArtifactImageBtn extends StatelessWidget {
|
class _ArtifactImageBtn extends StatelessWidget {
|
||||||
const _ArtifactImageBtn({Key? key, required this.data}) : super(key: key);
|
const _ArtifactImageBtn({super.key, required this.data});
|
||||||
final ArtifactData data;
|
final ArtifactData data;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../artifact_details_screen.dart';
|
part of '../artifact_details_screen.dart';
|
||||||
|
|
||||||
class _InfoColumn extends StatelessWidget {
|
class _InfoColumn extends StatelessWidget {
|
||||||
const _InfoColumn({Key? key, required this.data}) : super(key: key);
|
const _InfoColumn({super.key, required this.data});
|
||||||
final ArtifactData data;
|
final ArtifactData data;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -67,7 +67,7 @@ class _InfoColumn extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _InfoRow extends StatelessWidget {
|
class _InfoRow extends StatelessWidget {
|
||||||
const _InfoRow(this.label, this.value, {Key? key}) : super(key: key);
|
const _InfoRow(this.label, this.value, {super.key});
|
||||||
|
|
||||||
final String label;
|
final String label;
|
||||||
final String value;
|
final String value;
|
||||||
|
@ -15,7 +15,7 @@ part 'widgets/_search_input.dart';
|
|||||||
/// User can use this screen to search the MET server for an artifact by name or timeline. Artifacts results will
|
/// User can use this screen to search the MET server for an artifact by name or timeline. Artifacts results will
|
||||||
/// appear as images, which the user can click on to being up the details view for more information.
|
/// appear as images, which the user can click on to being up the details view for more information.
|
||||||
class ArtifactSearchScreen extends StatefulWidget with GetItStatefulWidgetMixin {
|
class ArtifactSearchScreen extends StatefulWidget with GetItStatefulWidgetMixin {
|
||||||
ArtifactSearchScreen({Key? key, required this.type}) : super(key: key);
|
ArtifactSearchScreen({super.key, required this.type});
|
||||||
final WonderType type;
|
final WonderType type;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -203,7 +203,7 @@ class _ArtifactSearchScreenState extends State<ArtifactSearchScreen> with GetItS
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PanelController extends ValueNotifier<bool> {
|
class PanelController extends ValueNotifier<bool> {
|
||||||
PanelController(bool value) : super(value);
|
PanelController(super.value);
|
||||||
void toggle() => value = !value;
|
void toggle() => value = !value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,14 +11,14 @@ import 'package:wonders/ui/screens/artifact/artifact_search/time_range_selector/
|
|||||||
// Expandable timerange selector component that further refines Artifact Search based on date range.
|
// Expandable timerange selector component that further refines Artifact Search based on date range.
|
||||||
class ExpandingTimeRangeSelector extends StatefulWidget {
|
class ExpandingTimeRangeSelector extends StatefulWidget {
|
||||||
const ExpandingTimeRangeSelector({
|
const ExpandingTimeRangeSelector({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.wonder,
|
required this.wonder,
|
||||||
required this.startYear,
|
required this.startYear,
|
||||||
required this.endYear,
|
required this.endYear,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
required this.panelController,
|
required this.panelController,
|
||||||
required this.vizController,
|
required this.vizController,
|
||||||
}) : super(key: key);
|
});
|
||||||
final WonderData wonder;
|
final WonderData wonder;
|
||||||
final double startYear;
|
final double startYear;
|
||||||
final double endYear;
|
final double endYear;
|
||||||
@ -95,10 +95,9 @@ class _ExpandingTimeRangeSelectorState extends State<ExpandingTimeRangeSelector>
|
|||||||
|
|
||||||
class _ClosedTimeRange extends StatelessWidget {
|
class _ClosedTimeRange extends StatelessWidget {
|
||||||
const _ClosedTimeRange({
|
const _ClosedTimeRange({
|
||||||
Key? key,
|
|
||||||
required this.startYear,
|
required this.startYear,
|
||||||
required this.endYear,
|
required this.endYear,
|
||||||
}) : super(key: key);
|
});
|
||||||
final double startYear, endYear;
|
final double startYear, endYear;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -120,14 +119,13 @@ class _ClosedTimeRange extends StatelessWidget {
|
|||||||
|
|
||||||
class _OpenedTimeRange extends StatelessWidget {
|
class _OpenedTimeRange extends StatelessWidget {
|
||||||
const _OpenedTimeRange({
|
const _OpenedTimeRange({
|
||||||
Key? key,
|
|
||||||
required this.onChange,
|
required this.onChange,
|
||||||
required this.startYear,
|
required this.startYear,
|
||||||
required this.endYear,
|
required this.endYear,
|
||||||
required this.wonder,
|
required this.wonder,
|
||||||
required this.painter,
|
required this.painter,
|
||||||
required this.onClose,
|
required this.onClose,
|
||||||
}) : super(key: key);
|
});
|
||||||
final double startYear;
|
final double startYear;
|
||||||
final double endYear;
|
final double endYear;
|
||||||
final void Function(double start, double end) onChange;
|
final void Function(double start, double end) onChange;
|
||||||
|
@ -6,7 +6,7 @@ class RangeSelector extends StatefulWidget {
|
|||||||
static const double handleWidth = 20;
|
static const double handleWidth = 20;
|
||||||
|
|
||||||
const RangeSelector({
|
const RangeSelector({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.start,
|
required this.start,
|
||||||
required this.end,
|
required this.end,
|
||||||
required this.min,
|
required this.min,
|
||||||
@ -15,7 +15,7 @@ class RangeSelector extends StatefulWidget {
|
|||||||
this.isLocked = false,
|
this.isLocked = false,
|
||||||
this.onUpdated,
|
this.onUpdated,
|
||||||
this.onChanged,
|
this.onChanged,
|
||||||
}) : super(key: key);
|
});
|
||||||
final double start;
|
final double start;
|
||||||
final double end;
|
final double end;
|
||||||
final double min;
|
final double min;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../artifact_search_screen.dart';
|
part of '../artifact_search_screen.dart';
|
||||||
|
|
||||||
class _ResultTile extends StatelessWidget {
|
class _ResultTile extends StatelessWidget {
|
||||||
const _ResultTile({Key? key, required this.onPressed, required this.data}) : super(key: key);
|
const _ResultTile({super.key, required this.onPressed, required this.data});
|
||||||
|
|
||||||
final void Function(SearchData data) onPressed;
|
final void Function(SearchData data) onPressed;
|
||||||
final SearchData data;
|
final SearchData data;
|
||||||
|
@ -2,7 +2,7 @@ part of '../artifact_search_screen.dart';
|
|||||||
|
|
||||||
/// Staggered Masonry styled grid for displaying two columns of different aspect-ratio images.
|
/// Staggered Masonry styled grid for displaying two columns of different aspect-ratio images.
|
||||||
class _ResultsGrid extends StatefulWidget {
|
class _ResultsGrid extends StatefulWidget {
|
||||||
const _ResultsGrid({Key? key, required this.searchResults, required this.onPressed}) : super(key: key);
|
const _ResultsGrid({super.key, required this.searchResults, required this.onPressed});
|
||||||
final void Function(SearchData) onPressed;
|
final void Function(SearchData) onPressed;
|
||||||
final List<SearchData> searchResults;
|
final List<SearchData> searchResults;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ part of '../artifact_search_screen.dart';
|
|||||||
|
|
||||||
/// Autopopulating textfield used for searching for Artifacts by name.
|
/// Autopopulating textfield used for searching for Artifacts by name.
|
||||||
class _SearchInput extends StatelessWidget {
|
class _SearchInput extends StatelessWidget {
|
||||||
const _SearchInput({Key? key, required this.onSubmit, required this.wonder}) : super(key: key);
|
const _SearchInput({super.key, required this.onSubmit, required this.wonder});
|
||||||
final void Function(String) onSubmit;
|
final void Function(String) onSubmit;
|
||||||
final WonderData wonder;
|
final WonderData wonder;
|
||||||
|
|
||||||
@ -23,7 +23,9 @@ class _SearchInput extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Iterable<String> _getSuggestions(TextEditingValue textEditingValue) {
|
Iterable<String> _getSuggestions(TextEditingValue textEditingValue) {
|
||||||
if (textEditingValue.text == '') return wonder.searchSuggestions.getRange(0, 10);
|
if (textEditingValue.text == '') {
|
||||||
|
return wonder.searchSuggestions.getRange(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
return wonder.searchSuggestions.where((str) {
|
return wonder.searchSuggestions.where((str) {
|
||||||
return str.startsWith(textEditingValue.text.toLowerCase());
|
return str.startsWith(textEditingValue.text.toLowerCase());
|
||||||
|
@ -12,7 +12,7 @@ part 'widgets/_celebration_particles.dart';
|
|||||||
class CollectibleFoundScreen extends StatelessWidget {
|
class CollectibleFoundScreen extends StatelessWidget {
|
||||||
// CollectibleItem passes in a (theoretically) pre-loaded imageProvider.
|
// CollectibleItem passes in a (theoretically) pre-loaded imageProvider.
|
||||||
// we could check for load completion, and hold after introT, but that shouldn't be necessary in a real-world scenario.
|
// we could check for load completion, and hold after introT, but that shouldn't be necessary in a real-world scenario.
|
||||||
const CollectibleFoundScreen({required this.collectible, required this.imageProvider, Key? key}) : super(key: key);
|
const CollectibleFoundScreen({required this.collectible, required this.imageProvider, super.key});
|
||||||
|
|
||||||
final CollectibleData collectible;
|
final CollectibleData collectible;
|
||||||
final ImageProvider imageProvider;
|
final ImageProvider imageProvider;
|
||||||
@ -44,7 +44,10 @@ class CollectibleFoundScreen extends StatelessWidget {
|
|||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
).animate().scale(begin: 1.5, end: 3, curve: Curves.easeInExpo, delay: t, duration: t * 3).fadeOut(),
|
)
|
||||||
|
.animate()
|
||||||
|
.scale(begin: Offset(1.5, 1.5), end: Offset(3, 3), curve: Curves.easeInExpo, delay: t, duration: t * 3)
|
||||||
|
.fadeOut(),
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -140,14 +143,14 @@ class CollectibleFoundScreen extends StatelessWidget {
|
|||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.scale(begin: 0.3, duration: t * 2, curve: Curves.easeOutExpo, alignment: Alignment(0, 0.7));
|
.scale(begin: Offset(0.3, 0.3), duration: t * 2, curve: Curves.easeOutExpo, alignment: Alignment(0, 0.7));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildRibbon(BuildContext context) {
|
Widget _buildRibbon(BuildContext context) {
|
||||||
Duration t = $styles.times.fast;
|
Duration t = $styles.times.fast;
|
||||||
return _AnimatedRibbon($strings.collectibleFoundTitleArtifactDiscovered.toUpperCase())
|
return _AnimatedRibbon($strings.collectibleFoundTitleArtifactDiscovered.toUpperCase())
|
||||||
.animate()
|
.animate()
|
||||||
.scale(begin: 0.3, duration: t * 2, curve: Curves.easeOutExpo, alignment: Alignment(0, -1));
|
.scale(begin: Offset(0.3, 0.3), duration: t * 2, curve: Curves.easeOutExpo, alignment: Alignment(0, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTitle(BuildContext context, String text, TextStyle style, Color color, Duration delay) {
|
Widget _buildTitle(BuildContext context, String text, TextStyle style, Color color, Duration delay) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../collectible_found_screen.dart';
|
part of '../collectible_found_screen.dart';
|
||||||
|
|
||||||
class _AnimatedRibbon extends StatelessWidget {
|
class _AnimatedRibbon extends StatelessWidget {
|
||||||
const _AnimatedRibbon(this.text, {Key? key}) : super(key: key);
|
const _AnimatedRibbon(this.text, {super.key});
|
||||||
|
|
||||||
final String text;
|
final String text;
|
||||||
static const double height = 48;
|
static const double height = 48;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../collectible_found_screen.dart';
|
part of '../collectible_found_screen.dart';
|
||||||
|
|
||||||
class _CelebrationParticles extends StatelessWidget {
|
class _CelebrationParticles extends StatelessWidget {
|
||||||
const _CelebrationParticles({Key? key, this.fadeMs = 1000}) : super(key: key);
|
const _CelebrationParticles({super.key, this.fadeMs = 1000});
|
||||||
|
|
||||||
final int fadeMs;
|
final int fadeMs;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ part 'widgets/_collection_list_card.dart';
|
|||||||
part 'widgets/_newly_discovered_items_btn.dart';
|
part 'widgets/_newly_discovered_items_btn.dart';
|
||||||
|
|
||||||
class CollectionScreen extends StatefulWidget with GetItStatefulWidgetMixin {
|
class CollectionScreen extends StatefulWidget with GetItStatefulWidgetMixin {
|
||||||
CollectionScreen({required this.fromId, Key? key}) : super(key: key);
|
CollectionScreen({required this.fromId, super.key});
|
||||||
|
|
||||||
final String fromId;
|
final String fromId;
|
||||||
|
|
||||||
|
@ -2,12 +2,12 @@ part of '../collection_screen.dart';
|
|||||||
|
|
||||||
class _CollectibleImage extends StatelessWidget {
|
class _CollectibleImage extends StatelessWidget {
|
||||||
const _CollectibleImage({
|
const _CollectibleImage({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.collectible,
|
required this.collectible,
|
||||||
required this.state,
|
required this.state,
|
||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
this.heroTag,
|
this.heroTag,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final CollectibleData collectible;
|
final CollectibleData collectible;
|
||||||
final ValueSetter<CollectibleData> onPressed;
|
final ValueSetter<CollectibleData> onPressed;
|
||||||
|
@ -2,7 +2,7 @@ part of '../collection_screen.dart';
|
|||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class _CollectionFooter extends StatelessWidget {
|
class _CollectionFooter extends StatelessWidget {
|
||||||
const _CollectionFooter({Key? key, required this.count, required this.total}) : super(key: key);
|
const _CollectionFooter({super.key, required this.count, required this.total});
|
||||||
|
|
||||||
final int count;
|
final int count;
|
||||||
final int total;
|
final int total;
|
||||||
@ -42,9 +42,10 @@ class _CollectionFooter extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildProgressRow(BuildContext context) {
|
Widget _buildProgressRow(BuildContext context) {
|
||||||
|
int percent = (count / total * 100).round();
|
||||||
return Row(children: [
|
return Row(children: [
|
||||||
Text(
|
Text(
|
||||||
$strings.collectionLabelDiscovered((count / total * 100).round()),
|
$strings.collectionLabelDiscovered(percent),
|
||||||
style: $styles.text.body.copyWith(color: $styles.colors.accent1),
|
style: $styles.text.body.copyWith(color: $styles.colors.accent1),
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
|
@ -3,11 +3,11 @@ part of '../collection_screen.dart';
|
|||||||
@immutable
|
@immutable
|
||||||
class _CollectionList extends StatefulWidget with GetItStatefulWidgetMixin {
|
class _CollectionList extends StatefulWidget with GetItStatefulWidgetMixin {
|
||||||
_CollectionList({
|
_CollectionList({
|
||||||
Key? key,
|
super.key,
|
||||||
this.onReset,
|
this.onReset,
|
||||||
required this.fromId,
|
required this.fromId,
|
||||||
this.scrollKey,
|
this.scrollKey,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
static const double _vtCardExtent = 300;
|
static const double _vtCardExtent = 300;
|
||||||
static const double _hzCardExtent = 600;
|
static const double _hzCardExtent = 600;
|
||||||
@ -63,7 +63,7 @@ class _CollectionListState extends State<_CollectionList> with GetItStateMixin {
|
|||||||
fromId: widget.fromId,
|
fromId: widget.fromId,
|
||||||
data: d,
|
data: d,
|
||||||
);
|
);
|
||||||
}).toList()
|
})
|
||||||
];
|
];
|
||||||
// Scroll view adapts to scroll vertically or horizontally
|
// Scroll view adapts to scroll vertically or horizontally
|
||||||
return SingleChildScrollView(
|
return SingleChildScrollView(
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../collection_screen.dart';
|
part of '../collection_screen.dart';
|
||||||
|
|
||||||
class _CollectionListCard extends StatelessWidget with GetItMixin {
|
class _CollectionListCard extends StatelessWidget with GetItMixin {
|
||||||
_CollectionListCard({Key? key, this.width, this.height, required this.data, required this.fromId}) : super(key: key);
|
_CollectionListCard({super.key, this.width, this.height, required this.data, required this.fromId});
|
||||||
|
|
||||||
final double? width;
|
final double? width;
|
||||||
final double? height;
|
final double? height;
|
||||||
@ -48,7 +48,7 @@ class _CollectionListCard extends StatelessWidget with GetItMixin {
|
|||||||
heroTag: e.id == fromId ? 'collectible_image_$fromId' : null,
|
heroTag: e.id == fromId ? 'collectible_image_$fromId' : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList()
|
})
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -2,7 +2,7 @@ part of '../collection_screen.dart';
|
|||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class _NewlyDiscoveredItemsBtn extends StatelessWidget {
|
class _NewlyDiscoveredItemsBtn extends StatelessWidget {
|
||||||
const _NewlyDiscoveredItemsBtn({Key? key, this.count = 0, required this.onPressed}) : super(key: key);
|
const _NewlyDiscoveredItemsBtn({super.key, this.count = 0, required this.onPressed});
|
||||||
|
|
||||||
final int count;
|
final int count;
|
||||||
final VoidCallback onPressed;
|
final VoidCallback onPressed;
|
||||||
|
@ -38,7 +38,7 @@ part 'widgets/_title_text.dart';
|
|||||||
part 'widgets/_top_illustration.dart';
|
part 'widgets/_top_illustration.dart';
|
||||||
|
|
||||||
class WonderEditorialScreen extends StatefulWidget {
|
class WonderEditorialScreen extends StatefulWidget {
|
||||||
const WonderEditorialScreen(this.data, {Key? key, required this.contentPadding}) : super(key: key);
|
const WonderEditorialScreen(this.data, {super.key, required this.contentPadding});
|
||||||
final WonderData data;
|
final WonderData data;
|
||||||
//final void Function(double scrollPos) onScroll;
|
//final void Function(double scrollPos) onScroll;
|
||||||
final EdgeInsets contentPadding;
|
final EdgeInsets contentPadding;
|
||||||
@ -170,8 +170,7 @@ class _WonderEditorialScreenState extends State<WonderEditorialScreen> {
|
|||||||
),
|
),
|
||||||
|
|
||||||
/// Home Btn
|
/// Home Btn
|
||||||
SafeArea(
|
AnimatedBuilder(
|
||||||
child: AnimatedBuilder(
|
|
||||||
animation: _scroller,
|
animation: _scroller,
|
||||||
builder: (_, child) {
|
builder: (_, child) {
|
||||||
return AnimatedOpacity(
|
return AnimatedOpacity(
|
||||||
@ -187,7 +186,6 @@ class _WonderEditorialScreenState extends State<WonderEditorialScreen> {
|
|||||||
child: BackBtn(icon: AppIcons.north, onPressed: _handleBackPressed),
|
child: BackBtn(icon: AppIcons.north, onPressed: _handleBackPressed),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _AppBar extends StatelessWidget {
|
class _AppBar extends StatelessWidget {
|
||||||
_AppBar(this.wonderType, {Key? key, required this.sectionIndex, required this.scrollPos}) : super(key: key);
|
_AppBar(this.wonderType, {super.key, required this.sectionIndex, required this.scrollPos});
|
||||||
final WonderType wonderType;
|
final WonderType wonderType;
|
||||||
final ValueNotifier<int> sectionIndex;
|
final ValueNotifier<int> sectionIndex;
|
||||||
final ValueNotifier<double> scrollPos;
|
final ValueNotifier<double> scrollPos;
|
||||||
@ -18,24 +18,16 @@ class _AppBar extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
|
|
||||||
ArchType _getArchType() {
|
ArchType _getArchType() {
|
||||||
switch (wonderType) {
|
return switch (wonderType) {
|
||||||
case WonderType.chichenItza:
|
WonderType.chichenItza => ArchType.flatPyramid,
|
||||||
return ArchType.flatPyramid;
|
WonderType.christRedeemer => ArchType.wideArch,
|
||||||
case WonderType.christRedeemer:
|
WonderType.colosseum => ArchType.arch,
|
||||||
return ArchType.wideArch;
|
WonderType.greatWall => ArchType.arch,
|
||||||
case WonderType.colosseum:
|
WonderType.machuPicchu => ArchType.pyramid,
|
||||||
return ArchType.arch;
|
WonderType.petra => ArchType.wideArch,
|
||||||
case WonderType.greatWall:
|
WonderType.pyramidsGiza => ArchType.pyramid,
|
||||||
return ArchType.arch;
|
WonderType.tajMahal => ArchType.spade
|
||||||
case WonderType.machuPicchu:
|
};
|
||||||
return ArchType.pyramid;
|
|
||||||
case WonderType.petra:
|
|
||||||
return ArchType.wideArch;
|
|
||||||
case WonderType.pyramidsGiza:
|
|
||||||
return ArchType.pyramid;
|
|
||||||
case WonderType.tajMahal:
|
|
||||||
return ArchType.spade;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -3,7 +3,7 @@ part of '../editorial_screen.dart';
|
|||||||
class _Callout extends StatelessWidget {
|
class _Callout extends StatelessWidget {
|
||||||
final String text;
|
final String text;
|
||||||
|
|
||||||
const _Callout({Key? key, required this.text}) : super(key: key);
|
const _Callout({super.key, required this.text});
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return IntrinsicHeight(
|
return IntrinsicHeight(
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _CircularTitleBar extends StatelessWidget {
|
class _CircularTitleBar extends StatelessWidget {
|
||||||
const _CircularTitleBar({Key? key, required this.titles, required this.icons, required this.index})
|
const _CircularTitleBar({super.key, required this.titles, required this.icons, required this.index})
|
||||||
: assert(titles.length == icons.length, 'The number of titles and icons do not match.'),
|
: assert(titles.length == icons.length, 'The number of titles and icons do not match.');
|
||||||
super(key: key);
|
|
||||||
final List<String> titles;
|
final List<String> titles;
|
||||||
final List<String> icons;
|
final List<String> icons;
|
||||||
final int index;
|
final int index;
|
||||||
@ -35,10 +34,8 @@ class _CircularTitleBar extends StatelessWidget {
|
|||||||
BottomCenter(
|
BottomCenter(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(bottom: 20),
|
padding: EdgeInsets.only(bottom: 20),
|
||||||
child: Image.asset('${ImagePaths.common}/${icons[index]}')
|
child: Image.asset('${ImagePaths.common}/${icons[index]}').animate(key: ValueKey(index)).fade().scale(
|
||||||
.animate(key: ValueKey(index))
|
begin: Offset(.5, .5), end: Offset(1, 1), curve: Curves.easeOutBack, duration: $styles.times.med),
|
||||||
.fade()
|
|
||||||
.scale(begin: .5, end: 1, curve: Curves.easeOutBack, duration: $styles.times.med),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -50,10 +47,10 @@ class _CircularTitleBar extends StatelessWidget {
|
|||||||
|
|
||||||
class _AnimatedCircleWithText extends StatefulWidget {
|
class _AnimatedCircleWithText extends StatefulWidget {
|
||||||
const _AnimatedCircleWithText({
|
const _AnimatedCircleWithText({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.titles,
|
required this.titles,
|
||||||
required this.index,
|
required this.index,
|
||||||
}) : super(key: key);
|
});
|
||||||
|
|
||||||
final List<String> titles;
|
final List<String> titles;
|
||||||
final int index;
|
final int index;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _CollapsingPullQuoteImage extends StatelessWidget {
|
class _CollapsingPullQuoteImage extends StatelessWidget {
|
||||||
const _CollapsingPullQuoteImage({Key? key, required this.scrollPos, required this.data}) : super(key: key);
|
const _CollapsingPullQuoteImage({super.key, required this.scrollPos, required this.data});
|
||||||
final ValueNotifier<double> scrollPos;
|
final ValueNotifier<double> scrollPos;
|
||||||
final WonderData data;
|
final WonderData data;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class _CollapsingPullQuoteImage extends StatelessWidget {
|
|||||||
if (top) offsetY *= -1; // flip?
|
if (top) offsetY *= -1; // flip?
|
||||||
return Transform.translate(
|
return Transform.translate(
|
||||||
offset: Offset(0, offsetY),
|
offset: Offset(0, offsetY),
|
||||||
child:Text(value, style: quoteStyle, textAlign: TextAlign.center),
|
child: Text(value, style: quoteStyle, textAlign: TextAlign.center),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _LargeSimpleQuote extends StatelessWidget {
|
class _LargeSimpleQuote extends StatelessWidget {
|
||||||
const _LargeSimpleQuote({Key? key, required this.text, required this.author}) : super(key: key);
|
const _LargeSimpleQuote({super.key, required this.text, required this.author});
|
||||||
final String text;
|
final String text;
|
||||||
final String author;
|
final String author;
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _ScrollingContent extends StatelessWidget {
|
class _ScrollingContent extends StatelessWidget {
|
||||||
const _ScrollingContent(this.data, {Key? key, required this.scrollPos, required this.sectionNotifier})
|
const _ScrollingContent(this.data, {super.key, required this.scrollPos, required this.sectionNotifier});
|
||||||
: super(key: key);
|
|
||||||
final WonderData data;
|
final WonderData data;
|
||||||
final ValueNotifier<double> scrollPos;
|
final ValueNotifier<double> scrollPos;
|
||||||
final ValueNotifier<int> sectionNotifier;
|
final ValueNotifier<int> sectionNotifier;
|
||||||
@ -64,16 +63,12 @@ class _ScrollingContent extends StatelessWidget {
|
|||||||
|
|
||||||
Widget buildHiddenCollectible({required int slot}) {
|
Widget buildHiddenCollectible({required int slot}) {
|
||||||
List<WonderType> getTypesForSlot(slot) {
|
List<WonderType> getTypesForSlot(slot) {
|
||||||
switch (slot) {
|
return switch (slot) {
|
||||||
case 0:
|
0 => [WonderType.chichenItza, WonderType.colosseum],
|
||||||
return [WonderType.chichenItza, WonderType.colosseum];
|
1 => [WonderType.pyramidsGiza, WonderType.petra],
|
||||||
case 1:
|
2 => [WonderType.machuPicchu, WonderType.christRedeemer],
|
||||||
return [WonderType.pyramidsGiza, WonderType.petra];
|
_ => [WonderType.tajMahal, WonderType.greatWall]
|
||||||
case 2:
|
};
|
||||||
return [WonderType.machuPicchu, WonderType.christRedeemer];
|
|
||||||
default:
|
|
||||||
return [WonderType.tajMahal, WonderType.greatWall];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return HiddenCollectible(
|
return HiddenCollectible(
|
||||||
@ -166,7 +161,7 @@ class _ScrollingContent extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _YouTubeThumbnail extends StatelessWidget {
|
class _YouTubeThumbnail extends StatelessWidget {
|
||||||
const _YouTubeThumbnail({Key? key, required this.id, required this.caption}) : super(key: key);
|
const _YouTubeThumbnail({super.key, required this.id, required this.caption});
|
||||||
final String id;
|
final String id;
|
||||||
final String caption;
|
final String caption;
|
||||||
|
|
||||||
@ -217,7 +212,7 @@ class _YouTubeThumbnail extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MapsThumbnail extends StatefulWidget {
|
class _MapsThumbnail extends StatefulWidget {
|
||||||
const _MapsThumbnail(this.data, {Key? key}) : super(key: key);
|
const _MapsThumbnail(this.data, {super.key});
|
||||||
final WonderData data;
|
final WonderData data;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -279,10 +274,10 @@ class _MapsThumbnailState extends State<_MapsThumbnail> {
|
|||||||
|
|
||||||
class SliverBackgroundColor extends SingleChildRenderObjectWidget {
|
class SliverBackgroundColor extends SingleChildRenderObjectWidget {
|
||||||
const SliverBackgroundColor({
|
const SliverBackgroundColor({
|
||||||
Key? key,
|
super.key,
|
||||||
required this.color,
|
required this.color,
|
||||||
Widget? sliver,
|
Widget? sliver,
|
||||||
}) : super(key: key, child: sliver);
|
}) : super(child: sliver);
|
||||||
|
|
||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _SectionDivider extends StatefulWidget {
|
class _SectionDivider extends StatefulWidget {
|
||||||
const _SectionDivider(this.scrollNotifier, this.sectionNotifier, {Key? key, required this.index}) : super(key: key);
|
const _SectionDivider(this.scrollNotifier, this.sectionNotifier, {super.key, required this.index});
|
||||||
final int index;
|
final int index;
|
||||||
final ValueNotifier<double> scrollNotifier;
|
final ValueNotifier<double> scrollNotifier;
|
||||||
final ValueNotifier<int> sectionNotifier;
|
final ValueNotifier<int> sectionNotifier;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _SlidingImageStack extends StatelessWidget {
|
class _SlidingImageStack extends StatelessWidget {
|
||||||
const _SlidingImageStack({Key? key, required this.scrollPos, required this.type}) : super(key: key);
|
const _SlidingImageStack({super.key, required this.scrollPos, required this.type});
|
||||||
|
|
||||||
final ValueNotifier<double> scrollPos;
|
final ValueNotifier<double> scrollPos;
|
||||||
final WonderType type;
|
final WonderType type;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _TitleText extends StatelessWidget {
|
class _TitleText extends StatelessWidget {
|
||||||
const _TitleText(this.data, {Key? key, required this.scroller}) : super(key: key);
|
const _TitleText(this.data, {super.key, required this.scroller});
|
||||||
final WonderData data;
|
final WonderData data;
|
||||||
final ScrollController scroller;
|
final ScrollController scroller;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of '../editorial_screen.dart';
|
part of '../editorial_screen.dart';
|
||||||
|
|
||||||
class _TopIllustration extends StatelessWidget {
|
class _TopIllustration extends StatelessWidget {
|
||||||
const _TopIllustration(this.type, {Key? key, this.fgOffset = Offset.zero}) : super(key: key);
|
const _TopIllustration(this.type, {super.key, this.fgOffset = Offset.zero});
|
||||||
final WonderType type;
|
final WonderType type;
|
||||||
final Offset fgOffset;
|
final Offset fgOffset;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
part of 'wonders_home_screen.dart';
|
part of 'wonders_home_screen.dart';
|
||||||
|
|
||||||
class _VerticalSwipeController {
|
class _VerticalSwipeController {
|
||||||
_VerticalSwipeController(this.ticker, this.onSwipeComplete){
|
_VerticalSwipeController(this.ticker, this.onSwipeComplete) {
|
||||||
swipeReleaseAnim = AnimationController(vsync: ticker)..addListener(handleSwipeReleaseAnimTick);
|
swipeReleaseAnim = AnimationController(vsync: ticker)..addListener(handleSwipeReleaseAnimTick);
|
||||||
}
|
}
|
||||||
final TickerProvider ticker;
|
final TickerProvider ticker;
|
||||||
@ -64,7 +64,7 @@ class _VerticalSwipeController {
|
|||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
child: child);
|
child: child);
|
||||||
|
|
||||||
void dispose(){
|
void dispose() {
|
||||||
swipeAmt.dispose();
|
swipeAmt.dispose();
|
||||||
isPointerDown.dispose();
|
isPointerDown.dispose();
|
||||||
swipeReleaseAnim.dispose();
|
swipeReleaseAnim.dispose();
|
||||||
|
@ -2,7 +2,7 @@ part of '../wonders_home_screen.dart';
|
|||||||
|
|
||||||
/// An arrow that fades out, then fades back in and slides down, ending in it's original position with full opacity.
|
/// An arrow that fades out, then fades back in and slides down, ending in it's original position with full opacity.
|
||||||
class _AnimatedArrowButton extends StatelessWidget {
|
class _AnimatedArrowButton extends StatelessWidget {
|
||||||
_AnimatedArrowButton({Key? key, required this.onTap, required this.semanticTitle}) : super(key: key);
|
_AnimatedArrowButton({required this.onTap, required this.semanticTitle});
|
||||||
|
|
||||||
final String semanticTitle;
|
final String semanticTitle;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
@ -17,7 +17,7 @@ part '_vertical_swipe_controller.dart';
|
|||||||
part 'widgets/_animated_arrow_button.dart';
|
part 'widgets/_animated_arrow_button.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatefulWidget with GetItStatefulWidgetMixin {
|
class HomeScreen extends StatefulWidget with GetItStatefulWidgetMixin {
|
||||||
HomeScreen({Key? key}) : super(key: key);
|
HomeScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HomeScreen> createState() => _HomeScreenState();
|
State<HomeScreen> createState() => _HomeScreenState();
|
||||||
@ -64,7 +64,9 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
|||||||
|
|
||||||
void _handlePageChanged(value) {
|
void _handlePageChanged(value) {
|
||||||
final newIndex = value % _numWonders;
|
final newIndex = value % _numWonders;
|
||||||
if (newIndex == _wonderIndex) return; // Exit early if we're already on this page
|
if (newIndex == _wonderIndex) {
|
||||||
|
return; // Exit early if we're already on this page
|
||||||
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
_wonderIndex = newIndex;
|
_wonderIndex = newIndex;
|
||||||
settingsLogic.prevWonderIndex.value = _wonderIndex;
|
settingsLogic.prevWonderIndex.value = _wonderIndex;
|
||||||
@ -195,7 +197,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
|||||||
..._wonders.map((e) {
|
..._wonders.map((e) {
|
||||||
final config = WonderIllustrationConfig.bg(isShowing: _isSelected(e.type));
|
final config = WonderIllustrationConfig.bg(isShowing: _isSelected(e.type));
|
||||||
return WonderIllustration(e.type, config: config);
|
return WonderIllustration(e.type, config: config);
|
||||||
}).toList(),
|
}),
|
||||||
// Clouds
|
// Clouds
|
||||||
FractionallySizedBox(
|
FractionallySizedBox(
|
||||||
widthFactor: 1,
|
widthFactor: 1,
|
||||||
@ -248,7 +250,7 @@ class _HomeScreenState extends State<HomeScreen> with SingleTickerProviderStateM
|
|||||||
onPlay: _handleFadeAnimInit,
|
onPlay: _handleFadeAnimInit,
|
||||||
child: IgnorePointer(child: WonderIllustration(e.type, config: config)));
|
child: IgnorePointer(child: WonderIllustration(e.type, config: config)));
|
||||||
});
|
});
|
||||||
}).toList(),
|
}),
|
||||||
|
|
||||||
/// Foreground gradient-2, gets darker when swiping up
|
/// Foreground gradient-2, gets darker when swiping up
|
||||||
BottomCenter(
|
BottomCenter(
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user