Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.moozenhq.digamobile">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.moozenhq.digamobile">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="digamobile"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<application android:name="io.flutter.app.FlutterApplication" android:label="digamobile" android:icon="@mipmap/ic_launcher">
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="flutterEmbedding" android:value="2" />
</application>
</manifest>
1 change: 1 addition & 0 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

1 change: 1 addition & 0 deletions android/settings_aar.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':app'
13 changes: 13 additions & 0 deletions lib/actions/messaging_actions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AddMessage {
final payload;

AddMessage(this.payload);
}

class AddAllMessages {
final payload;

AddAllMessages(this.payload);
}

class DeleteAllMessages {}
190 changes: 190 additions & 0 deletions lib/screens/app_base_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
import 'package:digamobile/screens/fragments/navigation_drawers/navigation_drawer.dart';
import 'package:digamobile/screens/fragments/templates/destination_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:line_awesome_icons/line_awesome_icons.dart';

import 'home_page.dart';

class AppBase extends StatefulWidget {
AppBase({Key key, this.isLoggedIn}) : super(key: key);
final isLoggedIn;
@override
_AppBaseState createState() => _AppBaseState();
}

class _AppBaseState extends State<AppBase> with TickerProviderStateMixin {
final GlobalKey<InnerDrawerState> _innerDrawerKey =
GlobalKey<InnerDrawerState>();

bool _onTapToClose = false;
bool _swipe = true;
bool _tapScaffold = true;
bool _isChatEnabled = true;
InnerDrawerAnimation _animationType = InnerDrawerAnimation.static;
double _offset = 0.4;

AnimationController _controller;
Animation<double> _drawerState;

double _dragUpdate = 0;
int _index = 0;
InnerDrawerDirection _direction = InnerDrawerDirection.start;

Color pickerColor = Color(0xff443a49);
Color currentColor = Colors.black54;
ValueChanged<Color> onColorChanged;

//navigation state
List<AnimationController> _faders;
List<Key> _destinationKeys;

// Custom navigator takes a global key if you want to access the
// navigator from outside it's widget tree subtree
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

@override
void initState() {
print("@@@@----MAIN____APPP____INIT___STATE");
_controller =
AnimationController(vsync: this, duration: Duration(milliseconds: 500));
_drawerState = Tween<double>(begin: 0.0, end: 1.0).animate(_controller);
_controller.addListener(() {
print("animating ${_drawerState.value}");

print("Clicked");
_direction = InnerDrawerDirection.start;
setState(() => _dragUpdate = _drawerState.value);
});
_drawerState.addListener(() {
setState(() {
print("Clicked");
this._dragUpdate = _drawerState.value;
});
});
_faders =
allDestinations.map<AnimationController>((PageDestination destination) {
return AnimationController(
vsync: this, duration: Duration(milliseconds: 500));
}).toList();
_faders[_index].value = 1.0;
_destinationKeys =
List<Key>.generate(allDestinations.length, (int index) => GlobalKey())
.toList();

super.initState();
}

@override
void dispose() {
for (AnimationController controller in _faders) controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: InnerDrawer(
key: _innerDrawerKey,
onTapClose: _onTapToClose,
tapScaffoldEnabled: _tapScaffold,

offset: IDOffset.horizontal(_offset),
swipe: _swipe,
boxShadow: _direction == InnerDrawerDirection.start &&
_animationType == InnerDrawerAnimation.linear
? []
: null,
colorTransition: currentColor,
leftAnimationType: _animationType,
rightAnimationType: InnerDrawerAnimation.linear,
leftChild: NavigationDrawer(
dragUpdate: _dragUpdate,
isSignedIn: widget.isLoggedIn,
),

//rightChild: MapFilterDrawer(),

onDragUpdate: (double val, InnerDrawerDirection direction) {
_direction = direction;
setState(() => _dragUpdate = val);
},
//innerDrawerCallback: (a) => print(a),
scaffold: Scaffold(
floatingActionButton: _isChatEnabled
? null
: FloatingActionButton.extended(
onPressed: () {},
label: Text("Appointment"),
icon: Icon(
Icons.add,
color: allDestinations[_index].materialColorLight,
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
extendBody: false,
bottomNavigationBar: BottomNavigationBar(
//type: BottomNavigationBarType.fixed,
selectedIconTheme: IconThemeData(size: 26),
selectedItemColor: allDestinations[_index].materialColor,
unselectedItemColor: Colors.grey.shade900,
showUnselectedLabels: true,
onTap: (index) {
// navigatorKey.currentState.maybePop();
setState(() => _index = index);
},
currentIndex: _index,
items: allDestinations
.map<BottomNavigationBarItem>((pageDestination) {
return BottomNavigationBarItem(
icon: Icon(pageDestination.icon),
activeIcon: Icon(pageDestination.activeIcon),
backgroundColor: pageDestination.materialColor,
title: Text(pageDestination.title));
}).toList(),
),
body: Stack(
fit: StackFit.expand,
children: allDestinations.map((PageDestination destination) {
final Widget view = FadeTransition(
opacity: _faders[destination.index]
.drive(CurveTween(curve: Curves.fastOutSlowIn)),
child: KeyedSubtree(
key: _destinationKeys[destination.index],
child: _index == 0
? HomePage(
"Welcome",
menuClicked: () {
print("clicked in base");
_controller.status == AnimationStatus.completed ||
_controller.status ==
AnimationStatus.reverse
? _controller.forward()
: _controller.reverse();
_controller.forward();
},
)
: DestinationView(
destination: destination,
),
),
);
if (destination.index == _index) {
_faders[destination.index].forward();
return view;
} else {
_faders[destination.index].reverse();
if (_faders[destination.index].isAnimating) {
return IgnorePointer(child: view);
}
return Offstage(child: view);
}
}).toList(),
)),
),
);
}
}
7 changes: 5 additions & 2 deletions lib/screens/authentication_service.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:digamobile/login_screen.dart';
import 'package:digamobile/screens/app_base_screen.dart';
import 'package:digamobile/screens/home_page.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
Expand All @@ -17,7 +18,9 @@ class AuthenticationService extends StatelessWidget {
stream: FirebaseAuth.instance.onAuthStateChanged,
builder: (context, snapshot) {
if (snapshot.hasData) {
return HomePage(title);
return AppBase(
isLoggedIn: true,
);
} else {
return LoginScreen();
}
Expand All @@ -26,4 +29,4 @@ class AuthenticationService extends StatelessWidget {
),
);
}
}
}
39 changes: 39 additions & 0 deletions lib/screens/fragments/chat_fragment.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'dart:async';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
import 'package:digamobile/screens/fragments/templates/destination_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ChatFragment extends StatefulWidget {
final PageDestination destination;

const ChatFragment({
Key key,
this.destination,
}) : super(key: key);
@override
_ChatFragmentState createState() => _ChatFragmentState();
}

class _ChatFragmentState extends State<ChatFragment> {
@override
Future<void> initState() {
super.initState();
}

@override
Widget build(BuildContext context) {
return new WebviewScaffold(
url:
"https://webchat.snatchbot.me/e30deda7335903ce072120872201193e4e9dac8004f8f2c770a6e3cb297bf8de",
appBar: new AppBar(
title: const Text('Diga Assistant'),
),
withZoom: true,
withLocalStorage: true,
hidden: true,
initialChild:
Center(child: Container(child: CircularProgressIndicator())),
);
}
}
Loading