Compare commits
19
Commits
c4758eac73
..
v0.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1879150e72 | ||
|
|
c233d71119 | ||
|
|
1e215ee86d | ||
|
|
b8d2fc208b | ||
|
|
a91364a5d7 | ||
|
|
db8f44234a | ||
|
|
921ce17736 | ||
|
|
4ce022d23d | ||
|
|
a875a1430d | ||
|
|
0360736af0 | ||
|
|
1802461f77 | ||
|
|
b92626b677 | ||
|
|
1a6bf08bde | ||
|
|
1f7b850d66 | ||
|
|
577801423d | ||
|
|
a97ec0411d | ||
|
|
02bce8318a | ||
|
|
5614888454 | ||
|
|
fd94dbf20d |
@@ -168,6 +168,15 @@ void main() async {
|
|||||||
|
|
||||||
final app = Router();
|
final app = Router();
|
||||||
|
|
||||||
|
// CORS preflight acceptor
|
||||||
|
app.options('/<ignored|.*>', (Request request) {
|
||||||
|
return Response.ok(null, headers: {
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS',
|
||||||
|
'Access-Control-Allow-Headers': '*',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// routes
|
// routes
|
||||||
app.get('/fbla-api/hello', (Request request) async {
|
app.get('/fbla-api/hello', (Request request) async {
|
||||||
print('Hello received');
|
print('Hello received');
|
||||||
@@ -820,6 +829,31 @@ void main() async {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
app.get('/fbla-api/clearbit/<website>',
|
||||||
|
(Request request, String website) async {
|
||||||
|
print('clearbit logo request received');
|
||||||
|
|
||||||
|
website = Uri.decodeComponent(website);
|
||||||
|
|
||||||
|
var response =
|
||||||
|
await http.get(Uri.parse('https://logo.clearbit.com/$website'));
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
return Response.ok(
|
||||||
|
response.bodyBytes,
|
||||||
|
headers: {
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Content-Type': 'image/png'
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Response.notFound(
|
||||||
|
'logo not found',
|
||||||
|
headers: {
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// get ip address for hosting
|
// get ip address for hosting
|
||||||
for (var interface in await NetworkInterface.list()) {
|
for (var interface in await NetworkInterface.list()) {
|
||||||
|
|||||||
Vendored
+16
-16
@@ -3,7 +3,7 @@ pipeline {
|
|||||||
stages {
|
stages {
|
||||||
stage('Flutter Cleanup') {
|
stage('Flutter Cleanup') {
|
||||||
steps {
|
steps {
|
||||||
sh '''flutter upgrade --force
|
sh '''flutter upgrade
|
||||||
flutter pub upgrade
|
flutter pub upgrade
|
||||||
flutter --version
|
flutter --version
|
||||||
flutter doctor
|
flutter doctor
|
||||||
@@ -40,10 +40,10 @@ flutter clean'''
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def remote = [
|
def remote = [
|
||||||
name: 'HostServer',
|
name : 'HostServer',
|
||||||
host: '192.168.0.216',
|
host : '192.168.0.216',
|
||||||
user: 'fbla',
|
user : 'fbla',
|
||||||
password: 'fbla',
|
password : 'fbla',
|
||||||
allowAnyHosts: true,
|
allowAnyHosts: true,
|
||||||
]
|
]
|
||||||
sshRemove(path: '/home/fbla/fbla-webserver/webfiles/fbla', remote: remote)
|
sshRemove(path: '/home/fbla/fbla-webserver/webfiles/fbla', remote: remote)
|
||||||
@@ -58,13 +58,13 @@ flutter clean'''
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def remote = [
|
def remote = [
|
||||||
name: 'HostServer',
|
name : 'HostServer',
|
||||||
host: '192.168.0.216',
|
host : '192.168.0.216',
|
||||||
user: 'fbla',
|
user : 'fbla',
|
||||||
password: 'fbla',
|
password : 'fbla',
|
||||||
allowAnyHosts: true,
|
allowAnyHosts: true,
|
||||||
]
|
]
|
||||||
if(env.BRANCH_NAME == 'main') {
|
if (env.BRANCH_NAME == 'main') {
|
||||||
sshRemove(path: '/home/fbla/builds/main/linux', remote: remote)
|
sshRemove(path: '/home/fbla/builds/main/linux', remote: remote)
|
||||||
sshCommand remote: remote, command: "mkdir /home/fbla/builds/main/linux"
|
sshCommand remote: remote, command: "mkdir /home/fbla/builds/main/linux"
|
||||||
sshPut(from: 'build/linux/x64/release', into: '/home/fbla/builds/main/linux', remote: remote)
|
sshPut(from: 'build/linux/x64/release', into: '/home/fbla/builds/main/linux', remote: remote)
|
||||||
@@ -105,12 +105,12 @@ flutter clean'''
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
def remote = [
|
def remote = [
|
||||||
name: 'MarinoDev',
|
name : 'MarinoDev',
|
||||||
host: 'marinodev.com',
|
host : 'marinodev.com',
|
||||||
port: 21098,
|
port : 21098,
|
||||||
user: 'mariehdi',
|
user : 'mariehdi',
|
||||||
identityFile: '/var/jenkins_home/marinoDevPrivateKey',
|
identityFile : '/var/jenkins_home/marinoDevPrivateKey',
|
||||||
passphrase: 'marinodev',
|
passphrase : 'marinodev',
|
||||||
allowAnyHosts: true,
|
allowAnyHosts: true,
|
||||||
]
|
]
|
||||||
sshRemove(path: '/home/mariehdi/public_html/fbla', remote: remote)
|
sshRemove(path: '/home/mariehdi/public_html/fbla', remote: remote)
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
plugins {
|
||||||
|
id "com.android.application"
|
||||||
|
id "kotlin-android"
|
||||||
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
|
}
|
||||||
|
|
||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
def localPropertiesFile = rootProject.file('local.properties')
|
def localPropertiesFile = rootProject.file('local.properties')
|
||||||
if (localPropertiesFile.exists()) {
|
if (localPropertiesFile.exists()) {
|
||||||
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
||||||
if (flutterRoot == null) {
|
|
||||||
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
||||||
}
|
|
||||||
|
|
||||||
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
||||||
if (flutterVersionCode == null) {
|
if (flutterVersionCode == null) {
|
||||||
flutterVersionCode = '1'
|
flutterVersionCode = '1'
|
||||||
@@ -21,10 +22,6 @@ if (flutterVersionName == null) {
|
|||||||
flutterVersionName = '1.0'
|
flutterVersionName = '1.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace "com.marinodev.fbla_ui"
|
namespace "com.marinodev.fbla_ui"
|
||||||
compileSdkVersion flutter.compileSdkVersion
|
compileSdkVersion flutter.compileSdkVersion
|
||||||
@@ -69,5 +66,4 @@ flutter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,3 @@
|
|||||||
buildscript {
|
|
||||||
ext.kotlin_version = '1.7.10'
|
|
||||||
repositories {
|
|
||||||
google()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
@@ -22,6 +9,7 @@ rootProject.buildDir = '../build'
|
|||||||
subprojects {
|
subprojects {
|
||||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
include ':app'
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
def properties = new Properties()
|
|
||||||
|
|
||||||
assert localPropertiesFile.exists()
|
repositories {
|
||||||
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
plugins {
|
||||||
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
|
id "com.android.application" version "7.3.0" apply false
|
||||||
|
id "org.jetbrains.kotlin.android" version "1.9.24" apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
@@ -99,8 +99,6 @@ class _HomeState extends State<Home> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
bool widescreen = MediaQuery.sizeOf(context).width >= widescreenWidth;
|
bool widescreen = MediaQuery.sizeOf(context).width >= widescreenWidth;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// floatingActionButton: _getFAB(widescreen, scrollControllerBusinesses,
|
|
||||||
// scrollControllerJobs, currentPageIndex),
|
|
||||||
bottomNavigationBar: _getNavigationBar(widescreen),
|
bottomNavigationBar: _getNavigationBar(widescreen),
|
||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
edgeOffset: 145,
|
edgeOffset: 145,
|
||||||
@@ -173,13 +171,6 @@ class _HomeState extends State<Home> {
|
|||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
label: 'Job Listings'),
|
label: 'Job Listings'),
|
||||||
// NavigationDestination(
|
|
||||||
// icon: const Icon(Icons.description_outlined),
|
|
||||||
// selectedIcon: Icon(
|
|
||||||
// Icons.description,
|
|
||||||
// color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
// ),
|
|
||||||
// label: 'Export Data')
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -264,51 +255,11 @@ class _HomeState extends State<Home> {
|
|||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
label: const Text('Job Listings')),
|
label: const Text('Job Listings')),
|
||||||
// NavigationRailDestination(
|
|
||||||
// icon: const Icon(Icons.description_outlined),
|
|
||||||
// selectedIcon: Icon(
|
|
||||||
// Icons.description,
|
|
||||||
// color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
// ),
|
|
||||||
// label: const Text('Export Data'))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// children.first
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
// }
|
|
||||||
// return children.first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget _contentPane() {
|
|
||||||
// return IndexedStack(
|
|
||||||
// index: currentPageIndex,
|
|
||||||
// children: [
|
|
||||||
// BusinessesOverview(
|
|
||||||
// searchQuery: searchQuery,
|
|
||||||
// refreshBusinessDataOverviewFuture:
|
|
||||||
// refreshBusinessDataOverviewBusinessFuture,
|
|
||||||
// updateBusinessesCallback: _updateOverviewBusinessesBusinessCallback,
|
|
||||||
// themeCallback: widget.themeCallback,
|
|
||||||
// updateLoggedIn: _updateLoggedIn,
|
|
||||||
// ),
|
|
||||||
// JobsOverview(
|
|
||||||
// searchQuery: searchQuery,
|
|
||||||
// refreshJobDataOverviewFuture: refreshBusinessDataOverviewJobFuture,
|
|
||||||
// updateBusinessesCallback: _updateOverviewBusinessesJobsCallback,
|
|
||||||
// themeCallback: widget.themeCallback, updateLoggedIn: _updateLoggedIn),
|
|
||||||
// ExportData(
|
|
||||||
// searchQuery: searchQuery,
|
|
||||||
// refreshBusinessDataOverviewFuture:
|
|
||||||
// refreshBusinessDataOverviewBusinessFuture,
|
|
||||||
// updateBusinessesWithJobCallback:
|
|
||||||
// _updateOverviewBusinessesJobsCallback,
|
|
||||||
// themeCallback: widget.themeCallback,
|
|
||||||
// refreshJobDataOverviewFuture: refreshBusinessDataOverviewJobFuture,
|
|
||||||
// updateBusinessesCallback: _updateOverviewBusinessesBusinessCallback)
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ContentPane extends StatelessWidget {
|
class _ContentPane extends StatelessWidget {
|
||||||
@@ -354,35 +305,7 @@ class _ContentPane extends StatelessWidget {
|
|||||||
themeCallback: themeCallback,
|
themeCallback: themeCallback,
|
||||||
updateLoggedIn: updateLoggedIn,
|
updateLoggedIn: updateLoggedIn,
|
||||||
),
|
),
|
||||||
// ExportData(
|
|
||||||
// searchQuery: searchQuery,
|
|
||||||
// refreshBusinessDataOverviewFuture:
|
|
||||||
// refreshBusinessDataOverviewBusinessFuture,
|
|
||||||
// updateBusinessesWithJobCallback:
|
|
||||||
// updateOverviewBusinessesJobsCallback,
|
|
||||||
// themeCallback: themeCallback,
|
|
||||||
// refreshJobDataOverviewFuture: refreshBusinessDataOverviewJobFuture,
|
|
||||||
// updateBusinessesCallback: updateOverviewBusinessesBusinessCallback)
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// class FABAnimator extends FloatingActionButtonAnimator {
|
|
||||||
// @override
|
|
||||||
// Offset getOffset({Offset begin, Offset end, double progress}) {
|
|
||||||
// return end;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Animation<double> getRotationAnimation({required Animation<double> parent}) {
|
|
||||||
// return Tween<double>(begin: 0.0, end: 1.0).animate(parent);
|
|
||||||
// throw UnimplementedError();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Animation<double> getScaleAnimation({required Animation<double> parent}) {
|
|
||||||
// return Tween<double>(begin: 0.0, end: 1.0).animate(parent);
|
|
||||||
// throw UnimplementedError();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|||||||
+16
-3
@@ -83,10 +83,16 @@ class _MainAppState extends State<MainApp> {
|
|||||||
iconTheme: const IconThemeData(color: Colors.white),
|
iconTheme: const IconThemeData(color: Colors.white),
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
// border: OutlineInputBorder(),
|
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.grey.withOpacity(0.1),
|
fillColor: Colors.grey.withOpacity(0.1),
|
||||||
labelStyle: const TextStyle(color: Colors.grey),
|
labelStyle: const TextStyle(color: Colors.grey),
|
||||||
|
floatingLabelStyle: WidgetStateTextStyle.resolveWith((states) {
|
||||||
|
if (states.contains(WidgetState.focused) &&
|
||||||
|
!states.contains(WidgetState.hovered)) {
|
||||||
|
return TextStyle(color: Colors.blue.shade700);
|
||||||
|
}
|
||||||
|
return const TextStyle(color: Colors.grey);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
dropdownMenuTheme: const DropdownMenuThemeData(
|
dropdownMenuTheme: const DropdownMenuThemeData(
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
@@ -110,8 +116,15 @@ class _MainAppState extends State<MainApp> {
|
|||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
// border: OutlineInputBorder(),
|
// border: OutlineInputBorder(),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: Colors.blue.withOpacity(0.1),
|
fillColor: Colors.grey.withOpacity(0.25),
|
||||||
labelStyle: const TextStyle(color: Colors.grey),
|
labelStyle: TextStyle(color: Colors.grey.shade700),
|
||||||
|
floatingLabelStyle: WidgetStateTextStyle.resolveWith((states) {
|
||||||
|
if (states.contains(WidgetState.focused) &&
|
||||||
|
!states.contains(WidgetState.hovered)) {
|
||||||
|
return TextStyle(color: Colors.blue.shade700);
|
||||||
|
}
|
||||||
|
return TextStyle(color: Colors.grey.shade700);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
dropdownMenuTheme: const DropdownMenuThemeData(
|
dropdownMenuTheme: const DropdownMenuThemeData(
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import 'package:fbla_ui/pages/create_edit_listing.dart';
|
|||||||
import 'package:fbla_ui/pages/listing_detail.dart';
|
import 'package:fbla_ui/pages/listing_detail.dart';
|
||||||
import 'package:fbla_ui/shared/api_logic.dart';
|
import 'package:fbla_ui/shared/api_logic.dart';
|
||||||
import 'package:fbla_ui/shared/global_vars.dart';
|
import 'package:fbla_ui/shared/global_vars.dart';
|
||||||
|
import 'package:fbla_ui/shared/utils.dart';
|
||||||
|
import 'package:fbla_ui/shared/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rive/rive.dart';
|
import 'package:rive/rive.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import '../shared/utils.dart';
|
|
||||||
|
|
||||||
class BusinessDetail extends StatefulWidget {
|
class BusinessDetail extends StatefulWidget {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
@@ -166,8 +166,7 @@ class _CreateBusinessDetailState extends State<BusinessDetail> {
|
|||||||
.replaceAll('www.', ''),
|
.replaceAll('www.', ''),
|
||||||
style: const TextStyle(color: Colors.blue)),
|
style: const TextStyle(color: Colors.blue)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
launchUrl(
|
launchUrl(Uri.parse(business.website!));
|
||||||
Uri.parse('https://${business.website}'));
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -175,85 +174,45 @@ class _CreateBusinessDetailState extends State<BusinessDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Available positions
|
// Available positions
|
||||||
if (business.listings != null)
|
if (business.listings != null || loggedIn)
|
||||||
Card(
|
Card(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 16, top: 4),
|
padding: const EdgeInsets.only(left: 16, top: 8),
|
||||||
child: _GetListingsTitle(business)),
|
child: _GetListingsTitle(business)),
|
||||||
|
if (business.listings != null)
|
||||||
_JobList(business: business)
|
_JobList(business: business)
|
||||||
|
else
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(left: 16.0),
|
||||||
|
child: Text('No job listings exist.'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: const Text('add one?'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) =>
|
||||||
|
CreateEditJobListing(
|
||||||
|
inputBusiness: business,
|
||||||
|
)));
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
// Contact info
|
// Contact info
|
||||||
Card(
|
ContactInformationCard(business: business),
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.only(left: 16.0, top: 8.0),
|
|
||||||
child: Text(
|
|
||||||
business.contactName!,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (business.contactPhone != null)
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.phone),
|
|
||||||
title: Text(business.contactPhone!),
|
|
||||||
// maybe replace ! with ?? ''. same is true for below
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).colorScheme.surface,
|
|
||||||
title:
|
|
||||||
Text('Contact ${business.contactName}'),
|
|
||||||
content: Text(
|
|
||||||
'Would you like to call or text ${business.contactName}?'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Text'),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrl(Uri.parse(
|
|
||||||
'sms:${business.contactPhone}'));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}),
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Call'),
|
|
||||||
onPressed: () async {
|
|
||||||
launchUrl(Uri.parse(
|
|
||||||
'tel:${business.contactPhone}'));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (business.contactEmail != null)
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.email),
|
|
||||||
title: Text(business.contactEmail!),
|
|
||||||
onTap: () {
|
|
||||||
launchUrl(
|
|
||||||
Uri.parse('mailto:${business.contactEmail}'));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Location
|
// Location
|
||||||
Card(
|
Card(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
@@ -381,6 +340,7 @@ class _JobListItem extends StatelessWidget {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
jobListing.description,
|
jobListing.description,
|
||||||
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
style: const TextStyle(overflow: TextOverflow.ellipsis),
|
||||||
|
maxLines: 2,
|
||||||
),
|
),
|
||||||
trailing: _getEditIcon(context, fromBusiness, jobListing),
|
trailing: _getEditIcon(context, fromBusiness, jobListing),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@@ -421,14 +381,16 @@ class _GetListingsTitle extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!loggedIn) {
|
if (!loggedIn) {
|
||||||
return const Text('Available Postitions',
|
return Text(
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold));
|
'Available Postitions (${fromBusiness.listings?.length ?? '0'})',
|
||||||
|
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold));
|
||||||
} else {
|
} else {
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
const Text('Available Postitions',
|
Text('Available Postitions (${fromBusiness.listings?.length ?? '0'})',
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
style:
|
||||||
|
const TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 24.0),
|
padding: const EdgeInsets.only(right: 24.0),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
|||||||
@@ -450,6 +450,7 @@ class _BusinessHeaderState extends State<_BusinessHeader> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A desktop widget that displays basic info about a business
|
||||||
Widget _businessTile(Business business, BusinessType jobType) {
|
Widget _businessTile(Business business, BusinessType jobType) {
|
||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
@@ -512,7 +513,7 @@ class _BusinessHeaderState extends State<_BusinessHeader> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.link),
|
icon: const Icon(Icons.link),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
launchUrl(Uri.parse('https://${business.website}'));
|
launchUrl(Uri.parse(business.website!));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -573,6 +574,7 @@ class _BusinessHeaderState extends State<_BusinessHeader> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A mobile widget that displays basic info about a business
|
||||||
Widget _businessListItem(Business business, BusinessType? jobType) {
|
Widget _businessListItem(Business business, BusinessType? jobType) {
|
||||||
return Card(
|
return Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import 'package:fbla_ui/main.dart';
|
import 'package:fbla_ui/main.dart';
|
||||||
import 'package:fbla_ui/shared/api_logic.dart';
|
import 'package:fbla_ui/shared/api_logic.dart';
|
||||||
|
import 'package:fbla_ui/shared/global_vars.dart';
|
||||||
import 'package:fbla_ui/shared/utils.dart';
|
import 'package:fbla_ui/shared/utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import '../shared/global_vars.dart';
|
|
||||||
|
|
||||||
class CreateEditBusiness extends StatefulWidget {
|
class CreateEditBusiness extends StatefulWidget {
|
||||||
final Business? inputBusiness;
|
final Business? inputBusiness;
|
||||||
|
|
||||||
@@ -91,6 +90,7 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
),
|
),
|
||||||
floatingActionButton: !widescreen
|
floatingActionButton: !widescreen
|
||||||
? FloatingActionButton.extended(
|
? FloatingActionButton.extended(
|
||||||
|
heroTag: 'saveBusiness',
|
||||||
label: const Text('Save'),
|
label: const Text('Save'),
|
||||||
icon: _isLoading
|
icon: _isLoading
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
@@ -144,7 +144,7 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
leading: ClipRRect(
|
leading: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(6.0),
|
borderRadius: BorderRadius.circular(6.0),
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
'https://logo.clearbit.com/${business.website}',
|
'$apiAddress/clearbit/${Uri.encodeComponent(business.website ?? '')}',
|
||||||
width: 48,
|
width: 48,
|
||||||
height: 48, errorBuilder:
|
height: 48, errorBuilder:
|
||||||
(BuildContext context,
|
(BuildContext context,
|
||||||
@@ -171,8 +171,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
right: 8.0),
|
right: 8.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
maxLength: 30,
|
maxLength: 30,
|
||||||
onChanged: (inputName) {
|
onChanged: (inputName) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -198,8 +196,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
bottom: 8.0, left: 8.0, right: 8.0),
|
bottom: 8.0, left: 8.0, right: 8.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _descriptionController,
|
controller: _descriptionController,
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
maxLength: 500,
|
maxLength: 500,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
onChanged: (inputDesc) {
|
onChanged: (inputDesc) {
|
||||||
@@ -227,11 +223,12 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
left: 8.0, right: 8.0, bottom: 16.0),
|
left: 8.0, right: 8.0, bottom: 16.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _websiteController,
|
controller: _websiteController,
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
onChanged: (inputUrl) {
|
onChanged: (inputUrl) {
|
||||||
business.website = Uri.encodeFull(inputUrl);
|
setState(() {
|
||||||
|
business.website =
|
||||||
|
Uri.encodeFull(inputUrl);
|
||||||
|
});
|
||||||
if (inputUrl.trim().isEmpty) {
|
if (inputUrl.trim().isEmpty) {
|
||||||
business.website = null;
|
business.website = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -239,8 +236,10 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
.contains('http://') &&
|
.contains('http://') &&
|
||||||
!business.website!
|
!business.website!
|
||||||
.contains('https://')) {
|
.contains('https://')) {
|
||||||
|
setState(() {
|
||||||
business.website =
|
business.website =
|
||||||
'https://${business.website!.trim()}';
|
'https://${business.website!.trim()}';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -252,6 +251,7 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value != null &&
|
if (value != null &&
|
||||||
|
value.isNotEmpty &&
|
||||||
!RegExp(r'(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?:/[^/\s]*)*')
|
!RegExp(r'(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?:/[^/\s]*)*')
|
||||||
.hasMatch(value)) {
|
.hasMatch(value)) {
|
||||||
return 'Enter a valid Website';
|
return 'Enter a valid Website';
|
||||||
@@ -267,7 +267,12 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
left: 8.0, right: 8.0, bottom: 16.0),
|
left: 8.0, right: 8.0, bottom: 16.0),
|
||||||
child: DropdownMenu<BusinessType>(
|
child: DropdownMenu<BusinessType>(
|
||||||
initialSelection: business.type,
|
initialSelection: business.type,
|
||||||
// width: 776,
|
width: (MediaQuery.sizeOf(context).width -
|
||||||
|
24) <
|
||||||
|
776
|
||||||
|
? MediaQuery.sizeOf(context).width - 24
|
||||||
|
: 776,
|
||||||
|
menuHeight: 300,
|
||||||
label: const Text('Business Type'),
|
label: const Text('Business Type'),
|
||||||
errorText: dropDownErrorText,
|
errorText: dropDownErrorText,
|
||||||
dropdownMenuEntries: [
|
dropdownMenuEntries: [
|
||||||
@@ -287,79 +292,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(
|
|
||||||
// left: 8.0, right: 8.0, bottom: 16.0),
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// ElevatedButton(
|
|
||||||
// style: ButtonStyle(
|
|
||||||
// backgroundColor:
|
|
||||||
// MaterialStateProperty.all(
|
|
||||||
// Theme.of(context)
|
|
||||||
// .colorScheme
|
|
||||||
// .background)),
|
|
||||||
// child: const Row(
|
|
||||||
// children: [
|
|
||||||
// Icon(Icons.search),
|
|
||||||
// Text('Search For Location'),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// onPressed: () {},
|
|
||||||
// ),
|
|
||||||
// const Padding(
|
|
||||||
// padding: EdgeInsets.only(
|
|
||||||
// left: 32.0, right: 32.0),
|
|
||||||
// child: Text(
|
|
||||||
// 'OR',
|
|
||||||
// style: TextStyle(fontSize: 24),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// TextFormField(
|
|
||||||
// controller: _locationNameController,
|
|
||||||
// onChanged: (inputName) {
|
|
||||||
// setState(() {
|
|
||||||
// business.locationName =
|
|
||||||
// inputName;
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// onTapOutside:
|
|
||||||
// (PointerDownEvent event) {
|
|
||||||
// FocusScope.of(context).unfocus();
|
|
||||||
// },
|
|
||||||
// decoration: const InputDecoration(
|
|
||||||
// labelText:
|
|
||||||
// 'Location Name (optional)',
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// TextFormField(
|
|
||||||
// controller:
|
|
||||||
// _locationAddressController,
|
|
||||||
// onChanged: (inputAddr) {
|
|
||||||
// setState(() {
|
|
||||||
// business.locationAddress =
|
|
||||||
// inputAddr;
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// onTapOutside:
|
|
||||||
// (PointerDownEvent event) {
|
|
||||||
// FocusScope.of(context).unfocus();
|
|
||||||
// },
|
|
||||||
// decoration: const InputDecoration(
|
|
||||||
// labelText:
|
|
||||||
// 'Location Address (optional)',
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 8.0, right: 8.0, bottom: 16.0),
|
left: 8.0, right: 8.0, bottom: 16.0),
|
||||||
@@ -375,8 +307,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
labelText:
|
labelText:
|
||||||
'Contact Information Name (required)',
|
'Contact Information Name (required)',
|
||||||
),
|
),
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value == null || value.trim().isEmpty) {
|
if (value == null || value.trim().isEmpty) {
|
||||||
return 'Contact name is required';
|
return 'Contact name is required';
|
||||||
@@ -392,8 +322,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
controller: _contactPhoneController,
|
controller: _contactPhoneController,
|
||||||
inputFormatters: [PhoneFormatter()],
|
inputFormatters: [PhoneFormatter()],
|
||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
onChanged: (inputText) {
|
onChanged: (inputText) {
|
||||||
if (inputText.trim().isEmpty) {
|
if (inputText.trim().isEmpty) {
|
||||||
business.contactPhone = null;
|
business.contactPhone = null;
|
||||||
@@ -412,7 +340,9 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
(value == null || value.isEmpty)) {
|
(value == null || value.isEmpty)) {
|
||||||
return 'At least one contact method is required';
|
return 'At least one contact method is required';
|
||||||
}
|
}
|
||||||
if (value != null && value.length != 14) {
|
if (value != null &&
|
||||||
|
value.isNotEmpty &&
|
||||||
|
value.length != 14) {
|
||||||
return 'Enter a valid phone number';
|
return 'Enter a valid phone number';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -432,8 +362,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
business.contactEmail = inputText.trim();
|
business.contactEmail = inputText.trim();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
onTapOutside: (PointerDownEvent event) {
|
onTapOutside: (PointerDownEvent event) {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
@@ -472,8 +400,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
business.locationName = inputName.trim();
|
business.locationName = inputName.trim();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
onTapOutside: (PointerDownEvent event) {
|
onTapOutside: (PointerDownEvent event) {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
@@ -498,8 +424,6 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
business.locationAddress = inputAddr;
|
business.locationAddress = inputAddr;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
onTapOutside: (PointerDownEvent event) {
|
onTapOutside: (PointerDownEvent event) {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
},
|
},
|
||||||
@@ -550,15 +474,26 @@ class _CreateEditBusinessState extends State<CreateEditBusiness> {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: FilledButton(
|
child: FilledButton(
|
||||||
child: const Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 8.0, right: 8.0, bottom: 8.0),
|
top: 8.0, right: 8.0, bottom: 8.0),
|
||||||
child: Icon(Icons.save),
|
child: _isLoading
|
||||||
|
? SizedBox(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onPrimary,
|
||||||
|
strokeWidth: 3.0,
|
||||||
),
|
),
|
||||||
Text('Save'),
|
)
|
||||||
|
: const Icon(Icons.save),
|
||||||
|
),
|
||||||
|
const Text('Save'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
id: null,
|
id: null,
|
||||||
businessId: null,
|
businessId: null,
|
||||||
name: 'Job Listing',
|
name: 'Job Listing',
|
||||||
description: 'Add details about the business below.',
|
description: 'Add details about the job below.',
|
||||||
type: null,
|
type: null,
|
||||||
wage: null,
|
wage: null,
|
||||||
link: null,
|
link: null,
|
||||||
@@ -60,6 +60,9 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
.replaceAll('www.', ''));
|
.replaceAll('www.', ''));
|
||||||
getBusinessNameMapping = fetchBusinessNames();
|
getBusinessNameMapping = fetchBusinessNames();
|
||||||
businessName = widget.inputBusiness?.name ?? 'Offering business';
|
businessName = widget.inputBusiness?.name ?? 'Offering business';
|
||||||
|
if (widget.inputBusiness != null) {
|
||||||
|
listing.businessId = widget.inputBusiness!.id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
@@ -67,9 +70,6 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
widescreen = MediaQuery.sizeOf(context).width >= widescreenWidth;
|
widescreen = MediaQuery.sizeOf(context).width >= widescreenWidth;
|
||||||
if (widget.inputBusiness != null) {
|
|
||||||
listing.businessId = widget.inputBusiness!.id;
|
|
||||||
}
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: !_isLoading,
|
canPop: !_isLoading,
|
||||||
onPopInvoked: _handlePop,
|
onPopInvoked: _handlePop,
|
||||||
@@ -83,6 +83,7 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
),
|
),
|
||||||
floatingActionButton: !widescreen
|
floatingActionButton: !widescreen
|
||||||
? FloatingActionButton.extended(
|
? FloatingActionButton.extended(
|
||||||
|
heroTag: 'saveListing',
|
||||||
label: const Text('Save'),
|
label: const Text('Save'),
|
||||||
icon: _isLoading
|
icon: _isLoading
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
@@ -209,6 +210,53 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
Card(
|
Card(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 8.0,
|
||||||
|
right: 8.0,
|
||||||
|
bottom: 8.0,
|
||||||
|
top: 8.0),
|
||||||
|
child: DropdownMenu<int>(
|
||||||
|
menuHeight: 300,
|
||||||
|
width: (MediaQuery.sizeOf(context)
|
||||||
|
.width -
|
||||||
|
24) <
|
||||||
|
776
|
||||||
|
? MediaQuery.sizeOf(context)
|
||||||
|
.width -
|
||||||
|
24
|
||||||
|
: 776,
|
||||||
|
errorText:
|
||||||
|
businessDropdownErrorText,
|
||||||
|
initialSelection:
|
||||||
|
widget.inputBusiness?.id,
|
||||||
|
label: const Text(
|
||||||
|
'Offering Business'),
|
||||||
|
dropdownMenuEntries: [
|
||||||
|
for (Map<String, dynamic> map
|
||||||
|
in nameMapping)
|
||||||
|
DropdownMenuEntry(
|
||||||
|
value: map['id']!,
|
||||||
|
label: map['name'])
|
||||||
|
],
|
||||||
|
onSelected: (inputType) {
|
||||||
|
setState(() {
|
||||||
|
listing.businessId =
|
||||||
|
inputType!;
|
||||||
|
businessName = nameMapping
|
||||||
|
.where((element) =>
|
||||||
|
element['id'] ==
|
||||||
|
listing.businessId)
|
||||||
|
.first['name'];
|
||||||
|
businessDropdownErrorText =
|
||||||
|
null;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Wrap(
|
child: Wrap(
|
||||||
@@ -217,7 +265,7 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 8.0,
|
left: 8.0,
|
||||||
right: 8.0,
|
right: 8.0,
|
||||||
bottom: 8.0,
|
bottom: 16.0,
|
||||||
top: 8.0),
|
top: 8.0),
|
||||||
child: DropdownMenu<JobType>(
|
child: DropdownMenu<JobType>(
|
||||||
initialSelection:
|
initialSelection:
|
||||||
@@ -227,6 +275,7 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
typeDropdownErrorText,
|
typeDropdownErrorText,
|
||||||
width: calculateDropdownWidth(
|
width: calculateDropdownWidth(
|
||||||
context),
|
context),
|
||||||
|
menuHeight: 300,
|
||||||
dropdownMenuEntries: [
|
dropdownMenuEntries: [
|
||||||
for (JobType type
|
for (JobType type
|
||||||
in JobType.values)
|
in JobType.values)
|
||||||
@@ -282,53 +331,6 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 8.0,
|
|
||||||
right: 8.0,
|
|
||||||
bottom: 16.0,
|
|
||||||
top: 8.0),
|
|
||||||
child: DropdownMenu<int>(
|
|
||||||
menuHeight: 300,
|
|
||||||
width: (MediaQuery.sizeOf(context)
|
|
||||||
.width -
|
|
||||||
24) <
|
|
||||||
776
|
|
||||||
? MediaQuery.sizeOf(context)
|
|
||||||
.width -
|
|
||||||
24
|
|
||||||
: 776,
|
|
||||||
errorText:
|
|
||||||
businessDropdownErrorText,
|
|
||||||
initialSelection:
|
|
||||||
widget.inputBusiness?.id,
|
|
||||||
label: const Text(
|
|
||||||
'Offering Business'),
|
|
||||||
dropdownMenuEntries: [
|
|
||||||
for (Map<String, dynamic> map
|
|
||||||
in nameMapping)
|
|
||||||
DropdownMenuEntry(
|
|
||||||
value: map['id']!,
|
|
||||||
label: map['name'])
|
|
||||||
],
|
|
||||||
onSelected: (inputType) {
|
|
||||||
setState(() {
|
|
||||||
listing.businessId =
|
|
||||||
inputType!;
|
|
||||||
businessName = nameMapping
|
|
||||||
.where((element) =>
|
|
||||||
element['id'] ==
|
|
||||||
listing.businessId)
|
|
||||||
.first['name'];
|
|
||||||
businessDropdownErrorText =
|
|
||||||
null;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 8.0,
|
left: 8.0,
|
||||||
@@ -336,9 +338,7 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
bottom: 8.0),
|
bottom: 8.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _nameController,
|
controller: _nameController,
|
||||||
autovalidateMode: AutovalidateMode
|
maxLength: 40,
|
||||||
.onUserInteraction,
|
|
||||||
maxLength: 30,
|
|
||||||
onChanged: (inputName) {
|
onChanged: (inputName) {
|
||||||
setState(() {
|
setState(() {
|
||||||
listing.name = inputName;
|
listing.name = inputName;
|
||||||
@@ -368,8 +368,6 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
bottom: 8.0),
|
bottom: 8.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _descriptionController,
|
controller: _descriptionController,
|
||||||
autovalidateMode: AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
maxLength: 500,
|
maxLength: 500,
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
onChanged: (inputDesc) {
|
onChanged: (inputDesc) {
|
||||||
@@ -422,8 +420,6 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
bottom: 16.0),
|
bottom: 16.0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: _linkController,
|
controller: _linkController,
|
||||||
autovalidateMode: AutovalidateMode
|
|
||||||
.onUserInteraction,
|
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
onChanged: (inputUrl) {
|
onChanged: (inputUrl) {
|
||||||
if (inputUrl != '') {
|
if (inputUrl != '') {
|
||||||
@@ -436,8 +432,9 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
listing.link =
|
listing.link =
|
||||||
'https://${listing.link}';
|
'https://${listing.link}';
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
listing.link = null;
|
listing.link = null;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value != null &&
|
if (value != null &&
|
||||||
@@ -475,7 +472,7 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 8.0,
|
top: 8.0,
|
||||||
right: 8.0,
|
right: 8.0,
|
||||||
bottom: 8.0),
|
bottom: 8.0),
|
||||||
@@ -492,9 +489,9 @@ class _CreateEditJobListingState extends State<CreateEditJobListing> {
|
|||||||
strokeWidth: 3.0,
|
strokeWidth: 3.0,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Icon(Icons.save),
|
: const Icon(Icons.save),
|
||||||
),
|
),
|
||||||
Text('Save'),
|
const Text('Save'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ import 'package:fbla_ui/pages/create_edit_listing.dart';
|
|||||||
import 'package:fbla_ui/shared/api_logic.dart';
|
import 'package:fbla_ui/shared/api_logic.dart';
|
||||||
import 'package:fbla_ui/shared/global_vars.dart';
|
import 'package:fbla_ui/shared/global_vars.dart';
|
||||||
import 'package:fbla_ui/shared/utils.dart';
|
import 'package:fbla_ui/shared/utils.dart';
|
||||||
|
import 'package:fbla_ui/shared/widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
/// A page to view all specific details about a single job listing (with its businesses contact info)
|
||||||
class JobListingDetail extends StatefulWidget {
|
class JobListingDetail extends StatefulWidget {
|
||||||
final JobListing listing;
|
final JobListing listing;
|
||||||
final Business fromBusiness;
|
final Business fromBusiness;
|
||||||
@@ -30,18 +32,41 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// body of the JobListingDetail
|
||||||
Widget _detailBody(JobListing listing) {
|
Widget _detailBody(JobListing listing) {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: [
|
children: [
|
||||||
// Title, logo, desc, website
|
|
||||||
Center(
|
Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 800,
|
width: 800,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
// Top summary card
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(top: 4.0),
|
padding: const EdgeInsets.only(top: 4.0),
|
||||||
child: Card(
|
child: _summaryCard(listing)),
|
||||||
|
// Wage card
|
||||||
|
if (listing.wage != null && listing.wage != '')
|
||||||
|
Card(
|
||||||
|
child: ListTile(
|
||||||
|
leading: const Icon(Icons.attach_money),
|
||||||
|
subtitle: Text(listing.wage!),
|
||||||
|
title: const Text('Wage Information'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Contact information for the business contact
|
||||||
|
ContactInformationCard(business: widget.fromBusiness)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Top card including title, logo, description, and business name
|
||||||
|
Widget _summaryCard(JobListing listing) {
|
||||||
|
return Card(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -55,8 +80,7 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
'${listing.name} (${getNameFromOfferType(listing.offerType!)})',
|
'${listing.name} (${getNameFromOfferType(listing.offerType!)})',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 24,
|
fontSize: 24, fontWeight: FontWeight.bold)),
|
||||||
fontWeight: FontWeight.bold)),
|
|
||||||
),
|
),
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -78,13 +102,10 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(listing.description),
|
||||||
listing.description,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
contentPadding:
|
contentPadding: const EdgeInsets.only(bottom: 8, left: 16),
|
||||||
const EdgeInsets.only(bottom: 8, left: 16),
|
|
||||||
leading: Badge(
|
leading: Badge(
|
||||||
label: Text(
|
label: Text(
|
||||||
getLetterFromOfferType(listing.offerType!),
|
getLetterFromOfferType(listing.offerType!),
|
||||||
@@ -93,19 +114,16 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
|
|||||||
largeSize: 24,
|
largeSize: 24,
|
||||||
offset: const Offset(12, -3),
|
offset: const Offset(12, -3),
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
backgroundColor:
|
backgroundColor: getColorFromOfferType(listing.offerType!),
|
||||||
getColorFromOfferType(listing.offerType!),
|
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(6.0),
|
borderRadius: BorderRadius.circular(6.0),
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
'$apiAddress/logos/${widget.fromBusiness.id}',
|
'$apiAddress/logos/${widget.fromBusiness.id}',
|
||||||
width: 48,
|
width: 48,
|
||||||
height: 48, errorBuilder:
|
height: 48, errorBuilder: (BuildContext context,
|
||||||
(BuildContext context, Object exception,
|
Object exception, StackTrace? stackTrace) {
|
||||||
StackTrace? stackTrace) {
|
|
||||||
return Icon(
|
return Icon(
|
||||||
getIconFromJobType(
|
getIconFromJobType(listing.type ?? JobType.other),
|
||||||
listing.type ?? JobType.other),
|
|
||||||
size: 48);
|
size: 48);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -123,96 +141,15 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
|
|||||||
.replaceAll('www.', ''),
|
.replaceAll('www.', ''),
|
||||||
style: const TextStyle(color: Colors.blue)),
|
style: const TextStyle(color: Colors.blue)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
launchUrl(Uri.parse('https://${listing.link!}'));
|
launchUrl(Uri.parse(listing.link!));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
// Wage
|
|
||||||
if (listing.wage != null && listing.wage != '')
|
|
||||||
Card(
|
|
||||||
child: ListTile(
|
|
||||||
leading: const Icon(Icons.attach_money),
|
|
||||||
subtitle: Text(listing.wage!),
|
|
||||||
title: const Text('Wage Information'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Card(
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.only(left: 16.0, top: 8.0),
|
|
||||||
child: Text(
|
|
||||||
widget.fromBusiness.contactName!,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 20, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
if (widget.fromBusiness.contactPhone != null)
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.phone),
|
|
||||||
title: Text(widget.fromBusiness.contactPhone!),
|
|
||||||
// maybe replace ! with ?? ''. same is true for below
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).colorScheme.surface,
|
|
||||||
title: Text(
|
|
||||||
'Contact ${widget.fromBusiness.contactName}'),
|
|
||||||
content: Text(
|
|
||||||
'Would you like to call or text ${widget.fromBusiness.contactName}?'),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Text'),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrl(Uri.parse(
|
|
||||||
'sms:${widget.fromBusiness.contactPhone}'));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}),
|
|
||||||
TextButton(
|
|
||||||
child: const Text('Call'),
|
|
||||||
onPressed: () async {
|
|
||||||
launchUrl(Uri.parse(
|
|
||||||
'tel:${widget.fromBusiness.contactPhone}'));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (widget.fromBusiness.contactEmail != null)
|
|
||||||
ListTile(
|
|
||||||
leading: const Icon(Icons.email),
|
|
||||||
title: Text(widget.fromBusiness.contactEmail!),
|
|
||||||
onTap: () {
|
|
||||||
launchUrl(Uri.parse(
|
|
||||||
'mailto:${widget.fromBusiness.contactEmail}'));
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Edit / delete actions if the user is logged in
|
||||||
List<Widget>? _getActions(JobListing listing, Business fromBusiness) {
|
List<Widget>? _getActions(JobListing listing, Business fromBusiness) {
|
||||||
if (loggedIn) {
|
if (loggedIn) {
|
||||||
return [
|
return [
|
||||||
@@ -258,7 +195,9 @@ class _CreateBusinessDetailState extends State<JobListingDetail> {
|
|||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => const MainApp()));
|
builder: (context) => const MainApp(
|
||||||
|
initialPage: 1,
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -151,7 +151,8 @@ class _JobsOverviewState extends State<JobsOverview> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_isRetrying = true;
|
_isRetrying = true;
|
||||||
});
|
});
|
||||||
await widget.updateBusinessesCallback(null, null);
|
await widget.updateBusinessesCallback(
|
||||||
|
null, null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -491,7 +492,7 @@ class _JobHeaderState extends State<_JobHeader> {
|
|||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
childCount: businesses.length,
|
childCount: businesses.length,
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return _businessTile(
|
return _jobBusinessTile(
|
||||||
businesses[index],
|
businesses[index],
|
||||||
widget.jobType,
|
widget.jobType,
|
||||||
);
|
);
|
||||||
@@ -504,7 +505,7 @@ class _JobHeaderState extends State<_JobHeader> {
|
|||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
childCount: businesses.length,
|
childCount: businesses.length,
|
||||||
(BuildContext context, int index) {
|
(BuildContext context, int index) {
|
||||||
return _businessListItem(
|
return _jobBusinessListItem(
|
||||||
businesses[index],
|
businesses[index],
|
||||||
widget.jobType,
|
widget.jobType,
|
||||||
);
|
);
|
||||||
@@ -514,7 +515,8 @@ class _JobHeaderState extends State<_JobHeader> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _businessTile(Business business, JobType jobType) {
|
/// A desktop widget that displays basic info about a job
|
||||||
|
Widget _jobBusinessTile(Business business, JobType jobType) {
|
||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
@@ -591,8 +593,7 @@ class _JobHeaderState extends State<_JobHeader> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.link),
|
icon: const Icon(Icons.link),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
launchUrl(Uri.parse(
|
launchUrl(Uri.parse(business.listings![0].link!));
|
||||||
'https://${business.listings![0].link!}'));
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -653,7 +654,8 @@ class _JobHeaderState extends State<_JobHeader> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _businessListItem(Business business, JobType? jobType) {
|
/// A mobile widget that displays basic info about a job
|
||||||
|
Widget _jobBusinessListItem(Business business, JobType? jobType) {
|
||||||
return Card(
|
return Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: Badge(
|
leading: Badge(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class _SignInPageState extends State<SignInPage> {
|
|||||||
heightFactor: 1.0,
|
heightFactor: 1.0,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 50, 12, 50),
|
padding: const EdgeInsets.fromLTRB(12, 50, 12, 50),
|
||||||
height: 475,
|
height: 450,
|
||||||
width: 500,
|
width: 500,
|
||||||
child: Card(
|
child: Card(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -60,9 +60,12 @@ class _SignInPageState extends State<SignInPage> {
|
|||||||
controller: _usernameController,
|
controller: _usernameController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
prefixIcon: Icon(Icons.person_outline),
|
prefixIcon: Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: Icon(Icons.person_outline),
|
||||||
|
),
|
||||||
labelText: 'Username',
|
labelText: 'Username',
|
||||||
border: OutlineInputBorder()),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
@@ -107,11 +110,13 @@ class _SignInPageState extends State<SignInPage> {
|
|||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
obscureText: obscurePassword,
|
obscureText: obscurePassword,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
prefixIcon: const Icon(Icons.fingerprint),
|
prefixIcon: const Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: Icon(Icons.fingerprint),
|
||||||
|
),
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
border: const OutlineInputBorder(),
|
|
||||||
suffixIcon: Padding(
|
suffixIcon: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.only(right: 16.0),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -131,35 +136,45 @@ class _SignInPageState extends State<SignInPage> {
|
|||||||
errorMessage!,
|
errorMessage!,
|
||||||
style: const TextStyle(color: Colors.red),
|
style: const TextStyle(color: Colors.red),
|
||||||
),
|
),
|
||||||
CheckboxListTile(
|
Padding(
|
||||||
value: rememberMe,
|
padding: const EdgeInsets.only(
|
||||||
onChanged: (value) async {
|
top: 8.0, left: 8.0, right: 8.0),
|
||||||
setState(() {
|
child: FilledButton(
|
||||||
rememberMe = value!;
|
style: FilledButton.styleFrom(
|
||||||
});
|
shape: const RoundedRectangleBorder(
|
||||||
},
|
borderRadius:
|
||||||
title: const Text('Remember me'),
|
BorderRadius.all(Radius.circular(6)))),
|
||||||
),
|
child: SizedBox(
|
||||||
ElevatedButton.icon(
|
width: 374,
|
||||||
style: ElevatedButton.styleFrom(
|
height: 40,
|
||||||
backgroundColor:
|
child: Row(
|
||||||
Theme.of(context).colorScheme.primary,
|
mainAxisSize: MainAxisSize.min,
|
||||||
// padding: const EdgeInsets.only(left: 20.0, right: 20.0, top: 12.0, bottom: 12.0),
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
),
|
children: [
|
||||||
icon: _isloading
|
_isloading
|
||||||
? const SizedBox(
|
? const Padding(
|
||||||
|
padding: EdgeInsets.only(right: 8.0),
|
||||||
|
child: SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(
|
child: CircularProgressIndicator(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
strokeWidth: 3,
|
strokeWidth: 3,
|
||||||
))
|
)),
|
||||||
: const Icon(Icons.done, color: Colors.white),
|
)
|
||||||
label: const Text('Sign In',
|
: const Padding(
|
||||||
style: TextStyle(color: Colors.white)),
|
padding: EdgeInsets.only(right: 8.0),
|
||||||
|
child: Icon(Icons.done,
|
||||||
|
color: Colors.white),
|
||||||
|
),
|
||||||
|
const Text('Sign in',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white, fontSize: 18)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
setState(() {
|
setState(() {
|
||||||
errorMessage = null;
|
|
||||||
_isloading = true;
|
_isloading = true;
|
||||||
});
|
});
|
||||||
jwt = await signIn(username, password).timeout(
|
jwt = await signIn(username, password).timeout(
|
||||||
@@ -189,6 +204,44 @@ class _SignInPageState extends State<SignInPage> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomLeft,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Checkbox(
|
||||||
|
value: rememberMe,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
rememberMe = value!;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Text('Remember me'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
setState(() {
|
||||||
|
rememberMe = !rememberMe;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'package:fbla_ui/shared/utils.dart';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
var apiAddress = 'https://homelab.marinodev.com/fbla-api';
|
var apiAddress = 'https://homelab.marinodev.com/fbla-api';
|
||||||
// var apiAddress = 'http://192.168.0.114:8000/fbla-api';
|
// var apiAddress = 'http://192.168.0.114:8000/fbla-api'; // TODO
|
||||||
|
|
||||||
var client = http.Client();
|
var client = http.Client();
|
||||||
|
|
||||||
@@ -58,8 +58,11 @@ Future fetchBusinessDataOverviewJobs(
|
|||||||
if (typeFilters != null && typeFilters.isNotEmpty) {
|
if (typeFilters != null && typeFilters.isNotEmpty) {
|
||||||
uriString +=
|
uriString +=
|
||||||
'?typeFilters=${typeFilters.map((jobType) => jobType.name).join(',')}';
|
'?typeFilters=${typeFilters.map((jobType) => jobType.name).join(',')}';
|
||||||
}
|
|
||||||
if (offerFilters != null && offerFilters.isNotEmpty) {
|
if (offerFilters != null && offerFilters.isNotEmpty) {
|
||||||
|
uriString +=
|
||||||
|
'&offerFilters=${offerFilters.map((offerType) => offerType.name).join(',')}';
|
||||||
|
}
|
||||||
|
} else if (offerFilters != null && offerFilters.isNotEmpty) {
|
||||||
uriString +=
|
uriString +=
|
||||||
'?offerFilters=${offerFilters.map((offerType) => offerType.name).join(',')}';
|
'?offerFilters=${offerFilters.map((offerType) => offerType.name).join(',')}';
|
||||||
}
|
}
|
||||||
@@ -87,20 +90,6 @@ Future fetchBusinessDataOverviewJobs(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return groupedBusinesses;
|
return groupedBusinesses;
|
||||||
// Map<JobType, List<Business>> groupedBusinesses = {};
|
|
||||||
//
|
|
||||||
// for (String stringType in decodedResponse.keys) {
|
|
||||||
// List<Business> businesses = [];
|
|
||||||
//
|
|
||||||
// for (Map<String, dynamic> map in decodedResponse[stringType]) {
|
|
||||||
// Business business = Business.fromJson(map);
|
|
||||||
// businesses.add(business);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// groupedBusinesses
|
|
||||||
// .addAll({JobType.values.byName(stringType): businesses});
|
|
||||||
// }
|
|
||||||
// return groupedBusinesses;
|
|
||||||
} else {
|
} else {
|
||||||
return 'Error ${response.statusCode}! Please try again later!';
|
return 'Error ${response.statusCode}! Please try again later!';
|
||||||
}
|
}
|
||||||
@@ -394,9 +383,6 @@ Future marinoDevLogo() async {
|
|||||||
Uri.parse('$apiAddress/marinodev'),
|
Uri.parse('$apiAddress/marinodev'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// File logo = File ('${getTemporaryDirectory().toString()}/marinodev.svg');
|
|
||||||
// logo.writeAsBytes(response.bodyBytes);
|
|
||||||
|
|
||||||
return response.bodyBytes;
|
return response.bodyBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ enum JobType {
|
|||||||
retail,
|
retail,
|
||||||
customerService,
|
customerService,
|
||||||
foodService,
|
foodService,
|
||||||
finance,
|
|
||||||
healthcare,
|
|
||||||
education,
|
education,
|
||||||
maintenance,
|
maintenance,
|
||||||
manufacturing,
|
manufacturing,
|
||||||
@@ -185,10 +183,6 @@ IconData getIconFromJobType(JobType type) {
|
|||||||
return Icons.support_agent;
|
return Icons.support_agent;
|
||||||
case JobType.foodService:
|
case JobType.foodService:
|
||||||
return Icons.restaurant;
|
return Icons.restaurant;
|
||||||
case JobType.finance:
|
|
||||||
return Icons.paid;
|
|
||||||
case JobType.healthcare:
|
|
||||||
return Icons.medical_services;
|
|
||||||
case JobType.education:
|
case JobType.education:
|
||||||
return Icons.school;
|
return Icons.school;
|
||||||
case JobType.maintenance:
|
case JobType.maintenance:
|
||||||
@@ -225,10 +219,6 @@ pw.IconData getPwIconFromJobType(JobType type) {
|
|||||||
return const pw.IconData(0xf0e2);
|
return const pw.IconData(0xf0e2);
|
||||||
case JobType.foodService:
|
case JobType.foodService:
|
||||||
return const pw.IconData(0xe56c);
|
return const pw.IconData(0xe56c);
|
||||||
case JobType.finance:
|
|
||||||
return const pw.IconData(0xf041);
|
|
||||||
case JobType.healthcare:
|
|
||||||
return const pw.IconData(0xf109);
|
|
||||||
case JobType.education:
|
case JobType.education:
|
||||||
return const pw.IconData(0xe80c);
|
return const pw.IconData(0xe80c);
|
||||||
case JobType.maintenance:
|
case JobType.maintenance:
|
||||||
@@ -265,10 +255,6 @@ String getNameFromJobType(JobType type) {
|
|||||||
return 'Customer Service';
|
return 'Customer Service';
|
||||||
case JobType.foodService:
|
case JobType.foodService:
|
||||||
return 'Food Service';
|
return 'Food Service';
|
||||||
case JobType.finance:
|
|
||||||
return 'Finance';
|
|
||||||
case JobType.healthcare:
|
|
||||||
return 'Healthcare';
|
|
||||||
case JobType.education:
|
case JobType.education:
|
||||||
return 'Education';
|
return 'Education';
|
||||||
case JobType.maintenance:
|
case JobType.maintenance:
|
||||||
|
|||||||
+71
-505
@@ -6,488 +6,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
// class BusinessDisplayPanel extends StatefulWidget {
|
|
||||||
// final Map<JobType, List<Business>>? jobGroupedBusinesses;
|
|
||||||
// final Map<BusinessType, List<Business>>? businessGroupedBusinesses;
|
|
||||||
// final bool widescreen;
|
|
||||||
// final Set<Business>? selectedBusinesses;
|
|
||||||
//
|
|
||||||
// const BusinessDisplayPanel(
|
|
||||||
// {super.key,
|
|
||||||
// this.jobGroupedBusinesses,
|
|
||||||
// this.businessGroupedBusinesses,
|
|
||||||
// required this.widescreen,
|
|
||||||
// this.selectedBusinesses});
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// State<BusinessDisplayPanel> createState() => _BusinessDisplayPanelState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _BusinessDisplayPanelState extends State<BusinessDisplayPanel> {
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// if ((widget.businessGroupedBusinesses?.keys ?? <BusinessType>[]).isEmpty &&
|
|
||||||
// (widget.jobGroupedBusinesses?.keys ?? <JobType>[]).isEmpty) {
|
|
||||||
// return const SliverToBoxAdapter(
|
|
||||||
// child: Center(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: EdgeInsets.all(16.0),
|
|
||||||
// child: Text(
|
|
||||||
// 'No results found!\nPlease change your search filters.',
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: TextStyle(fontSize: 18),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// List<BusinessHeader> headers = [];
|
|
||||||
// if (widget.jobGroupedBusinesses != null) {
|
|
||||||
// for (JobType jobType in widget.jobGroupedBusinesses!.keys) {
|
|
||||||
// headers.add(BusinessHeader(
|
|
||||||
// jobType: jobType,
|
|
||||||
// widescreen: widget.widescreen,
|
|
||||||
// // selectable: widget.selectable,
|
|
||||||
// selectedBusinesses: widget.selectedBusinesses,
|
|
||||||
// // updateSelectedBusinessesCallback:
|
|
||||||
// // widget.updateSelectedBusinessesCallback,
|
|
||||||
// businesses: widget.jobGroupedBusinesses![jobType]!));
|
|
||||||
// }
|
|
||||||
// headers.sort((a, b) => a.jobType!.index.compareTo(b.jobType!.index));
|
|
||||||
// return MultiSliver(children: headers);
|
|
||||||
// } else if (widget.businessGroupedBusinesses != null) {
|
|
||||||
// for (BusinessType businessType
|
|
||||||
// in widget.businessGroupedBusinesses!.keys) {
|
|
||||||
// headers.add(BusinessHeader(
|
|
||||||
// businessType: businessType,
|
|
||||||
// widescreen: widget.widescreen,
|
|
||||||
// selectedBusinesses: widget.selectedBusinesses,
|
|
||||||
// businesses: widget.businessGroupedBusinesses![businessType]!));
|
|
||||||
// }
|
|
||||||
// headers.sort(
|
|
||||||
// (a, b) => a.businessType!.index.compareTo(b.businessType!.index));
|
|
||||||
// return MultiSliver(children: headers);
|
|
||||||
// }
|
|
||||||
// return const Text('Error with input data!');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class BusinessHeader extends StatefulWidget {
|
|
||||||
// final JobType? jobType;
|
|
||||||
// final BusinessType? businessType;
|
|
||||||
// final List<Business> businesses;
|
|
||||||
// final Set<Business>? selectedBusinesses;
|
|
||||||
// final bool widescreen;
|
|
||||||
// final void Function()? updateSelectedBusinessesCallback;
|
|
||||||
//
|
|
||||||
// const BusinessHeader({
|
|
||||||
// super.key,
|
|
||||||
// this.jobType,
|
|
||||||
// this.businessType,
|
|
||||||
// required this.businesses,
|
|
||||||
// required this.widescreen,
|
|
||||||
// this.updateSelectedBusinessesCallback,
|
|
||||||
// this.selectedBusinesses,
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// State<BusinessHeader> createState() => _BusinessHeaderState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _BusinessHeaderState extends State<BusinessHeader> {
|
|
||||||
// refresh() {
|
|
||||||
// setState(() {});
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return SliverStickyHeader(
|
|
||||||
// header: Container(
|
|
||||||
// height: 55.0,
|
|
||||||
// color: Theme.of(context).colorScheme.primary,
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
// alignment: Alignment.centerLeft,
|
|
||||||
// child: _getHeaderRow(widget.selectedBusinesses),
|
|
||||||
// ),
|
|
||||||
// sliver: _getChildSliver(
|
|
||||||
// widget.businesses, widget.widescreen, widget.selectedBusinesses),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget _getHeaderRow(Set<Business>? selectedBusinesses) {
|
|
||||||
// if (selectedBusinesses != null) {
|
|
||||||
// return Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// children: [
|
|
||||||
// Row(
|
|
||||||
// children: [
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(left: 4.0, right: 12.0),
|
|
||||||
// child: Icon(
|
|
||||||
// widget.jobType != null
|
|
||||||
// ? getIconFromJobType(widget.jobType!)
|
|
||||||
// : getIconFromBusinessType(widget.businessType!),
|
|
||||||
// color: Theme.of(context).colorScheme.onPrimary,
|
|
||||||
// )),
|
|
||||||
// Text(widget.jobType != null
|
|
||||||
// ? getNameFromJobType(widget.jobType!)
|
|
||||||
// : getNameFromBusinessType(widget.businessType!)),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(right: 12.0),
|
|
||||||
// child: Checkbox(
|
|
||||||
// checkColor: Theme.of(context).colorScheme.primary,
|
|
||||||
// activeColor: Theme.of(context).colorScheme.onPrimary,
|
|
||||||
// value: widget.selectedBusinesses!.containsAll(widget.businesses),
|
|
||||||
// onChanged: (value) {
|
|
||||||
// if (value!) {
|
|
||||||
// setState(() {
|
|
||||||
// widget.selectedBusinesses!.addAll(widget.businesses);
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// setState(() {
|
|
||||||
// widget.selectedBusinesses!.removeAll(widget.businesses);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// return Row(
|
|
||||||
// children: [
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(left: 4.0, right: 12.0),
|
|
||||||
// child: Icon(
|
|
||||||
// widget.jobType != null
|
|
||||||
// ? getIconFromJobType(widget.jobType!)
|
|
||||||
// : getIconFromBusinessType(widget.businessType!),
|
|
||||||
// color: Theme.of(context).colorScheme.onPrimary,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Text(
|
|
||||||
// widget.jobType != null
|
|
||||||
// ? getNameFromJobType(widget.jobType!)
|
|
||||||
// : getNameFromBusinessType(widget.businessType!),
|
|
||||||
// style: TextStyle(color: Theme.of(context).colorScheme.onPrimary),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget _getChildSliver(List<Business> businesses, bool widescreen,
|
|
||||||
// Set<Business>? selectedBusinesses) {
|
|
||||||
// if (widescreen) {
|
|
||||||
// return SliverPadding(
|
|
||||||
// padding: const EdgeInsets.all(4),
|
|
||||||
// sliver: SliverGrid(
|
|
||||||
// gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
|
||||||
// mainAxisExtent: 250.0,
|
|
||||||
// maxCrossAxisExtent: 400.0,
|
|
||||||
// mainAxisSpacing: 4.0,
|
|
||||||
// crossAxisSpacing: 4.0,
|
|
||||||
// ),
|
|
||||||
// delegate: SliverChildBuilderDelegate(
|
|
||||||
// childCount: businesses.length,
|
|
||||||
// (BuildContext context, int index) {
|
|
||||||
// return BusinessCard(
|
|
||||||
// business: businesses[index],
|
|
||||||
// selectedBusinesses: selectedBusinesses,
|
|
||||||
// widescreen: widescreen,
|
|
||||||
// callback: refresh,
|
|
||||||
// jobType: widget.jobType,
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// return SliverList(
|
|
||||||
// delegate: SliverChildBuilderDelegate(
|
|
||||||
// childCount: businesses.length,
|
|
||||||
// (BuildContext context, int index) {
|
|
||||||
// return BusinessCard(
|
|
||||||
// business: businesses[index],
|
|
||||||
// selectedBusinesses: selectedBusinesses,
|
|
||||||
// widescreen: widescreen,
|
|
||||||
// callback: refresh,
|
|
||||||
// jobType: widget.jobType,
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class BusinessCard extends StatefulWidget {
|
|
||||||
// final Business business;
|
|
||||||
// final bool widescreen;
|
|
||||||
// final Set<Business>? selectedBusinesses;
|
|
||||||
// final Function callback;
|
|
||||||
// final JobType? jobType;
|
|
||||||
// final BusinessType? businessType;
|
|
||||||
//
|
|
||||||
// const BusinessCard({
|
|
||||||
// super.key,
|
|
||||||
// required this.business,
|
|
||||||
// required this.widescreen,
|
|
||||||
// required this.callback,
|
|
||||||
// this.jobType,
|
|
||||||
// this.businessType,
|
|
||||||
// this.selectedBusinesses,
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// State<BusinessCard> createState() => _BusinessCardState();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// class _BusinessCardState extends State<BusinessCard> {
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// if (widget.widescreen) {
|
|
||||||
// return _businessTile(widget.business, widget.selectedBusinesses,
|
|
||||||
// widget.jobType, widget.businessType);
|
|
||||||
// } else {
|
|
||||||
// return _businessListItem(widget.business, widget.selectedBusinesses,
|
|
||||||
// widget.callback, widget.jobType, widget.businessType);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget _businessTile(Business business, Set<Business>? selectedBusinesses,
|
|
||||||
// JobType? jobType, BusinessType? businessType) {
|
|
||||||
// return MouseRegion(
|
|
||||||
// cursor: SystemMouseCursors.click,
|
|
||||||
// child: GestureDetector(
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.of(context).push(MaterialPageRoute(
|
|
||||||
// builder: (context) => BusinessDetail(
|
|
||||||
// id: business.id,
|
|
||||||
// name: business.name!,
|
|
||||||
// )));
|
|
||||||
// },
|
|
||||||
// child: Card(
|
|
||||||
// clipBehavior: Clip.antiAlias,
|
|
||||||
// child: Column(
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
// children: [
|
|
||||||
// _getTileRow(business, selectedBusinesses, widget.callback),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Text(
|
|
||||||
// business.description!,
|
|
||||||
// maxLines: selectedBusinesses != null ? 7 : 5,
|
|
||||||
// overflow: TextOverflow.ellipsis,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// const Spacer(),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: selectedBusinesses == null
|
|
||||||
// ? Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
// children: [
|
|
||||||
// IconButton(
|
|
||||||
// icon: const Icon(Icons.link),
|
|
||||||
// onPressed: () {
|
|
||||||
// launchUrl(
|
|
||||||
// Uri.parse('https://${business.website}'));
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// if (business.locationName != '')
|
|
||||||
// IconButton(
|
|
||||||
// icon: const Icon(Icons.location_on),
|
|
||||||
// onPressed: () {
|
|
||||||
// launchUrl(Uri.parse(Uri.encodeFull(
|
|
||||||
// 'https://www.google.com/maps/search/?api=1&query=${business.locationName}')));
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// if ((business.contactPhone != null) &&
|
|
||||||
// (business.contactPhone != ''))
|
|
||||||
// IconButton(
|
|
||||||
// icon: const Icon(Icons.phone),
|
|
||||||
// onPressed: () {
|
|
||||||
// showDialog(
|
|
||||||
// context: context,
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return AlertDialog(
|
|
||||||
// backgroundColor: Theme.of(context)
|
|
||||||
// .colorScheme
|
|
||||||
// .surface,
|
|
||||||
// title: Text((business.contactName ==
|
|
||||||
// null ||
|
|
||||||
// business.contactName == '')
|
|
||||||
// ? 'Contact ${business.name}?'
|
|
||||||
// : 'Contact ${business.contactName}'),
|
|
||||||
// content: Text((business.contactName ==
|
|
||||||
// null ||
|
|
||||||
// business.contactName == '')
|
|
||||||
// ? 'Would you like to call or text ${business.name}?'
|
|
||||||
// : 'Would you like to call or text ${business.contactName}?'),
|
|
||||||
// actions: [
|
|
||||||
// TextButton(
|
|
||||||
// child: const Text('Text'),
|
|
||||||
// onPressed: () {
|
|
||||||
// launchUrl(Uri.parse(
|
|
||||||
// 'sms:${business.contactPhone}'));
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// }),
|
|
||||||
// TextButton(
|
|
||||||
// child: const Text('Call'),
|
|
||||||
// onPressed: () async {
|
|
||||||
// launchUrl(Uri.parse(
|
|
||||||
// 'tel:${business.contactPhone}'));
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// }),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// if (business.contactEmail != '')
|
|
||||||
// IconButton(
|
|
||||||
// icon: const Icon(Icons.email),
|
|
||||||
// onPressed: () {
|
|
||||||
// launchUrl(Uri.parse(
|
|
||||||
// 'mailto:${business.contactEmail}'));
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// )
|
|
||||||
// : null),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget _getTileRow(
|
|
||||||
// Business business, Set<Business>? selectedBusinesses, Function callback) {
|
|
||||||
// if (selectedBusinesses != null) {
|
|
||||||
// return Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
// children: [
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: ClipRRect(
|
|
||||||
// borderRadius: BorderRadius.circular(6.0),
|
|
||||||
// child: Image.network('$apiAddress/logos/${business.id}',
|
|
||||||
// height: 48, width: 48, errorBuilder: (BuildContext context,
|
|
||||||
// Object exception, StackTrace? stackTrace) {
|
|
||||||
// return Icon(
|
|
||||||
// getIconFromBusinessType(business.type!),
|
|
||||||
// size: 48,
|
|
||||||
// );
|
|
||||||
// }),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Flexible(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Text(
|
|
||||||
// business.name!,
|
|
||||||
// style:
|
|
||||||
// const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
||||||
// maxLines: 2,
|
|
||||||
// overflow: TextOverflow.ellipsis,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(right: 24.0),
|
|
||||||
// child: _checkbox(callback, selectedBusinesses),
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// return Row(
|
|
||||||
// children: [
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: ClipRRect(
|
|
||||||
// borderRadius: BorderRadius.circular(6.0),
|
|
||||||
// child: Image.network('$apiAddress/logos/${business.id}',
|
|
||||||
// height: 48, width: 48, errorBuilder: (BuildContext context,
|
|
||||||
// Object exception, StackTrace? stackTrace) {
|
|
||||||
// return Icon(getIconFromBusinessType(business.type!),
|
|
||||||
// size: 48);
|
|
||||||
// }),
|
|
||||||
// )),
|
|
||||||
// Flexible(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: const EdgeInsets.all(8.0),
|
|
||||||
// child: Text(
|
|
||||||
// business.name!,
|
|
||||||
// style:
|
|
||||||
// const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
|
||||||
// maxLines: 2,
|
|
||||||
// overflow: TextOverflow.ellipsis,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget _businessListItem(Business business, Set<Business>? selectedBusinesses,
|
|
||||||
// Function callback, JobType? jobType, BusinessType? businessType) {
|
|
||||||
// return Card(
|
|
||||||
// child: ListTile(
|
|
||||||
// leading: ClipRRect(
|
|
||||||
// borderRadius: BorderRadius.circular(3.0),
|
|
||||||
// child: Image.network('$apiAddress/logos/${business.id}',
|
|
||||||
// height: 24, width: 24, errorBuilder: (BuildContext context,
|
|
||||||
// Object exception, StackTrace? stackTrace) {
|
|
||||||
// return Icon(getIconFromBusinessType(business.type!));
|
|
||||||
// })),
|
|
||||||
// title: Text(business.name!),
|
|
||||||
// subtitle: Text(business.description!,
|
|
||||||
// maxLines: 1, overflow: TextOverflow.ellipsis),
|
|
||||||
// trailing: _getCheckbox(selectedBusinesses, callback),
|
|
||||||
// onTap: () {
|
|
||||||
// Navigator.of(context).push(MaterialPageRoute(
|
|
||||||
// builder: (context) => BusinessDetail(
|
|
||||||
// id: business.id,
|
|
||||||
// name: business.name!,
|
|
||||||
// )));
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget _checkbox(Function callback, Set<Business> selectedBusinesses) {
|
|
||||||
// return Checkbox(
|
|
||||||
// value: selectedBusinesses.contains(widget.business),
|
|
||||||
// onChanged: (value) {
|
|
||||||
// if (value!) {
|
|
||||||
// setState(() {
|
|
||||||
// selectedBusinesses.add(widget.business);
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// setState(() {
|
|
||||||
// selectedBusinesses.remove(widget.business);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// callback();
|
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Widget? _getCheckbox(Set<Business>? selectedBusinesses, Function callback) {
|
|
||||||
// if (selectedBusinesses != null) {
|
|
||||||
// return _checkbox(callback, selectedBusinesses);
|
|
||||||
// } else {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
class BusinessSearchBar extends StatefulWidget {
|
class BusinessSearchBar extends StatefulWidget {
|
||||||
final String searchTextHint;
|
final String searchTextHint;
|
||||||
final Widget filterIconButton;
|
final Widget filterIconButton;
|
||||||
@@ -745,29 +263,6 @@ class _MainSliverAppBarState extends State<MainSliverAppBar> {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
// IconButton(
|
|
||||||
// icon: const Icon(Icons.picture_as_pdf),
|
|
||||||
// onPressed: () async {
|
|
||||||
// if (!_isPreviousData) {
|
|
||||||
// ScaffoldMessenger.of(context).clearSnackBars();
|
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
// const SnackBar(
|
|
||||||
// width: 300,
|
|
||||||
// behavior: SnackBarBehavior.floating,
|
|
||||||
// content: Text('There is no data!'),
|
|
||||||
// duration: Duration(seconds: 2),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// } else {
|
|
||||||
// selectedDataTypesBusiness = <DataTypeBusiness>{};
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// MaterialPageRoute(
|
|
||||||
// builder: (context) => ExportData(
|
|
||||||
// groupedBusinesses: overviewBusinesses)));
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: 8.0),
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
@@ -841,3 +336,74 @@ class _MainSliverAppBarState extends State<MainSliverAppBar> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ContactInformationCard extends StatelessWidget {
|
||||||
|
final Business business;
|
||||||
|
|
||||||
|
ContactInformationCard({super.key, required this.business});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Card(
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16.0, top: 8.0),
|
||||||
|
child: Text(
|
||||||
|
business.contactName!,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (business.contactPhone != null)
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.phone),
|
||||||
|
title: Text(business.contactPhone!),
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||||
|
title: Text('Contact ${business.contactName}'),
|
||||||
|
content: Text(
|
||||||
|
'Would you like to call or text ${business.contactName}?'),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
child: const Text('Text'),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse('sms:${business.contactPhone}'));
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}),
|
||||||
|
TextButton(
|
||||||
|
child: const Text('Call'),
|
||||||
|
onPressed: () async {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse('tel:${business.contactPhone}'));
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (business.contactEmail != null)
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Icons.email),
|
||||||
|
title: Text(business.contactEmail!),
|
||||||
|
onTap: () {
|
||||||
|
launchUrl(Uri.parse('mailto:${business.contactEmail}'));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+10
-10
@@ -308,10 +308,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: "9c96da072b421e98183f9ea7464898428e764bc0ce5567f27ec8693442e72514"
|
sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.5"
|
version: "2.2.6"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -348,10 +348,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: pdf
|
name: pdf
|
||||||
sha256: "243f05342fc0bdf140eba5b069398985cdbdd3dbb1d776cf43d5ea29cc570ba6"
|
sha256: "81d5522bddc1ef5c28e8f0ee40b71708761753c163e0c93a40df56fd515ea0f0"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.10.8"
|
version: "3.11.0"
|
||||||
pdf_widget_wrapper:
|
pdf_widget_wrapper:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -372,10 +372,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: platform
|
name: platform
|
||||||
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "3.1.5"
|
||||||
plugin_platform_interface:
|
plugin_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -396,10 +396,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: printing
|
name: printing
|
||||||
sha256: "1c99cab90ebcc1fff65831d264627d5b529359d563e53f33ab9b8117f2d280bc"
|
sha256: cc4b256a5a89d5345488e3318897b595867f5181b8c5ed6fc63bfa5f2044aec3
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.12.0"
|
version: "5.13.1"
|
||||||
qr:
|
qr:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -412,10 +412,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: rive
|
name: rive
|
||||||
sha256: "03bae056e67a5c98f9523c34f8ea63c15b323426a7e8d76d7ebb93066d4df6dc"
|
sha256: "0342c9cd3c83ceeee4ad9246b98d628a2e9abd9d615acf69fa81fbbcf84a36ae"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.13.5"
|
version: "0.13.8"
|
||||||
rive_common:
|
rive_common:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
Reference in New Issue
Block a user