Skip to content

Commit

Permalink
map layout complete
Browse files Browse the repository at this point in the history
  • Loading branch information
richtwin567 committed Sep 5, 2020
1 parent 85559b7 commit 1cc7245
Show file tree
Hide file tree
Showing 23 changed files with 438 additions and 237 deletions.
11 changes: 11 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1599346530427</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 1 addition & 1 deletion android/app/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14/" />
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer" />
<classpathentry kind="output" path="bin/default" />
</classpath>
</classpath>
11 changes: 11 additions & 0 deletions android/app/.project
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1599346530711</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\:https://services.gradle.org/distributions/gradle-6.3-bin.zip
distributionUrl=https\:https://services.gradle.org/distributions/gradle-5.6.2-bin.zip
File renamed without changes.
8 changes: 4 additions & 4 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
import ContactsUI
import GoogleMaps

public class NativeContact: NSObject, CNContactViewControllerDelegate{
/* public class NativeContact: NSObject, CNContactViewControllerDelegate{
private(set) var displayName: String
private(set) var note: String
Expand Down Expand Up @@ -119,7 +119,7 @@ public class NativeContact: NSObject, CNContactViewControllerDelegate{
}
}

*/

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
Expand All @@ -130,7 +130,7 @@ public class NativeContact: NSObject, CNContactViewControllerDelegate{
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let contactsChannel = FlutterMethodChannel(name: "com.example.fst_app_flutter/native",
binaryMessenger: controller.binaryMessenger)
contactsChannel.setMethodCallHandler({
/* contactsChannel.setMethodCallHandler({
(call: FlutterMethodCall, result: FlutterResult) -> Void in
// Note: this method is invoked on the UI thread.
guard call.method == "saveNatively" else {
Expand All @@ -141,7 +141,7 @@ public class NativeContact: NSObject, CNContactViewControllerDelegate{
var contact = NativeContact(map:args)
contact.saveNatively()
}
})
}) */
GMSServices.provideAPIKey("AIzaSyC8crEFAO6MSNJMRK1lmo-WnSL7RLFu87w")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
Expand Down
11 changes: 8 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ import 'package:provider/provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
ThemeModel themeModel = ThemeModel();
await themeModel.init();
await precacheRive();
runApp(FSTApp(
try {
await themeModel.init();
await precacheRive();
} catch (e) {
}
runApp(DevicePreview(
child: FSTApp(
themeModel: themeModel,
),
));
}

Expand Down
12 changes: 6 additions & 6 deletions lib/models/from_postgres/contact/contact_model.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:fst_app_flutter/global_const.dart';
import 'package:fst_app_flutter/models/enums/department.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/contact_platform.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/contact_type.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/platform.dart';
import 'package:fst_app_flutter/utils/string_to_enum.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:fst_app_flutter/utils/permissions.dart';
Expand Down Expand Up @@ -81,21 +81,21 @@ class _PhoneNumber {
int _id;
int _contactID;
String _phone;
Platform _platforms;
ContactPlatform _platforms;

int get id => _id;
int get contactID => _contactID;
String get phone => _phone;
Platform get platforms => _platforms;
ContactPlatform get platforms => _platforms;

_PhoneNumber(dynamic phoneSet) {
Platform platform;
ContactPlatform platform;
switch (phoneSet['platforms']) {
case 'WHATSAPP':
platform = Platform.whatsapp;
platform = ContactPlatform.whatsapp;
break;
default:
platform = Platform.textCall;
platform = ContactPlatform.textCall;
break;
}
_id = phoneSet['id'];
Expand Down
7 changes: 7 additions & 0 deletions lib/models/from_postgres/contact/contact_platform.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enum ContactPlatform { textCall, whatsapp }

extension PlatformShortString on ContactPlatform {
String toShortString() {
return this.toString().split('.').last;
}
}
7 changes: 0 additions & 7 deletions lib/models/from_postgres/contact/platform.dart

This file was deleted.

4 changes: 2 additions & 2 deletions lib/models/sharing/vcard.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:fst_app_flutter/models/from_postgres/contact/contact_model.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/contact_platform.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/contact_type.dart';
import 'package:fst_app_flutter/models/from_postgres/contact/platform.dart';

class VCard {
final String vcf;
Expand Down Expand Up @@ -42,7 +42,7 @@ class VCard {
}
if (contact.phones.length > 0) {
contact.phones.forEach((phone) {
if (phone.platforms == Platform.whatsapp) {
if (phone.platforms == ContactPlatform.whatsapp) {
vCard +=
'TEL;TYPE=cell;TYPE=voice;TYPE=video;TYPE=text;waid=${rawPhoneNumber(phone.phone)}:${phone.phone}\n';
} else {
Expand Down
2 changes: 0 additions & 2 deletions lib/routing/generate_routes.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import 'package:flutter/material.dart';
import 'package:fst_app_flutter/models/preferences/theme_model.dart';
import 'package:fst_app_flutter/routing/slide_up_route.dart';
import 'package:fst_app_flutter/screens/app_preferences_screen/app_preferences_view.dart';
import 'package:fst_app_flutter/screens/campus_map_screen/campus_map_view.dart';
import 'package:fst_app_flutter/screens/contact_screen/contact_detail_page.dart';
import 'package:fst_app_flutter/screens/contact_screen/contact_view.dart';
import 'package:fst_app_flutter/screens/home_screen/home_view.dart';
import 'package:fst_app_flutter/screens/scholarship_screen/scholarship_view.dart';
import 'package:provider/provider.dart';
import 'routes.dart';

/// Handles routing in the app
Expand Down
43 changes: 41 additions & 2 deletions lib/screens/campus_map_screen/campus_map_view_mobile_state.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,50 @@
import 'package:flutter/material.dart';
import 'package:fst_app_flutter/models/preferences/theme_model.dart';
import 'package:fst_app_flutter/screens/campus_map_screen/campus_map_view_state.dart';
import 'package:fst_app_flutter/widgets/shape_borders/arrowed_tooltip.dart';

class CampusMapViewMobileLandscapeState extends CampusMapViewState {
CampusMapViewMobileLandscapeState({@required ThemeModel themeModel}) : super(themeModel);
CampusMapViewMobileLandscapeState({@required ThemeModel themeModel})
: super(themeModel);

@override
Widget build(BuildContext context) {
var map = super.build(context);
ArrowedTooltip shape = RightArrowTooltip(
arrowLength: MediaQuery.of(context).size.width * 0.09,
arrowWidth: MediaQuery.of(context).size.height * 0.05);

return Scaffold(
extendBodyBehindAppBar: true,
body: Stack(
children: [
map,
buildPositionedDataWindow(context, shape),
buildAppBar(context),
],
));
}
}

class CampusMapViewMobilePortraitState extends CampusMapViewState {
CampusMapViewMobilePortraitState({@required ThemeModel themeModel}) : super(themeModel);
CampusMapViewMobilePortraitState({@required ThemeModel themeModel})
: super(themeModel);

@override
Widget build(BuildContext context) {
var map = super.build(context);
ArrowedTooltip shape = DownArrowTooltip(
arrowLength: MediaQuery.of(context).size.height * 0.04,
arrowWidth: MediaQuery.of(context).size.width * 0.08);

return Scaffold(
extendBodyBehindAppBar: true,
body: Stack(
children: [
map,
buildPositionedDataWindow(context, shape),
buildAppBar(context),
],
));
}
}
Loading

0 comments on commit 1cc7245

Please sign in to comment.