Skip to content

Commit

Permalink
update app preferences screen layouts
Browse files Browse the repository at this point in the history
  • Loading branch information
richtwin567 committed Aug 28, 2020
1 parent 96ce41f commit 07a5c87
Show file tree
Hide file tree
Showing 18 changed files with 139 additions and 120 deletions.
1 change: 0 additions & 1 deletion lib/models/sharing/vcard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class VCard {
VCard(this.vcf);

factory VCard.fromContact(Contact contact) {

String rawPhoneNumber(String phone) {
String rawPhone = '';
for (var i = 0; i < phone.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AppPreferencesViewMobileLandscape extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Container();
return AppPreferencesViewMobilePortrait();
}
}

Expand All @@ -26,7 +26,16 @@ class AppPreferencesViewMobilePortrait extends StatelessWidget {
body: Consumer<ThemeModel>(builder: (context, themeModel, child) {
return ListView(children: [
ListTile(
leading: Icon(Icons.brush),
title: Text(
'Appearance',
style: Theme.of(context)
.textTheme
.caption
.apply(color: Theme.of(context).accentColor,fontWeightDelta: 2),
),
),
ListTile(
leading: Icon(Icons.palette),
title: Text('Theme'),
subtitle:
Text(themeModel.selectedTheme.toString().substring(10)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
import 'package:fst_app_flutter/screens/app_preferences_screen/app_preferences_view_mobile.dart';

class AppPreferencesViewTabletLandscape extends StatelessWidget {
const AppPreferencesViewTabletLandscape({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
);
return AppPreferencesViewMobilePortrait();
}
}

Expand All @@ -15,7 +15,6 @@ class AppPreferencesViewTabletPortrait extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Container(
);
return AppPreferencesViewMobilePortrait();
}
}
}
86 changes: 45 additions & 41 deletions lib/screens/contact_screen/contact_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import 'package:fst_app_flutter/models/from_postgres/contact/contact_model.dart'
import 'package:fst_app_flutter/models/from_postgres/contact/platform.dart';
import 'package:fst_app_flutter/models/sharing/vcard.dart';
import 'package:fst_app_flutter/utils/open_url.dart';
import 'package:fst_app_flutter/utils/permissions.dart';
import 'package:fst_app_flutter/utils/social_media_contact_share.dart';
import 'package:fst_app_flutter/widgets/contact_widgets/contact_card.dart';
import 'package:fst_app_flutter/widgets/contact_widgets/contact_detail_image.dart';
import 'package:permission_handler/permission_handler.dart';

/// A page that shows all the details for the selected contact.
/// It allows the user to open websites, call the contact and send an email to
Expand All @@ -29,46 +31,48 @@ class ContactDetailPage extends StatelessWidget {

return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
floating: false,
pinned: true,
snap: false,
actions: [
IconButton(
icon: Icon(Icons.save),
onPressed: () {
contactDetails.saveNatively();
}),
IconButton(
icon: Icon(Icons.share),
onPressed: () {
shareContactToWhatsApp(VCard.fromContact(contactDetails));
})
],
expandedHeight: mq.size.height / 2.5,
flexibleSpace: FlexibleSpaceBar(
background: CustomPaint(
painter: ContactDetailSvg(
start: Point(
mq.size.width / 2, (mq.size.height / 2.5) / 2),
scale:
(mq.devicePixelRatio / mq.size.aspectRatio) * 1.5,
color: Theme.of(context).accentColor)),
title: Padding(
padding: EdgeInsets.only(right: mq.size.width / 4),
child: Text(
contactDetails.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
))),
SliverList(
delegate:
SliverChildListDelegate.fixed([contactMethods, contactInfo]),
)
],
));
slivers: <Widget>[
SliverAppBar(
floating: false,
pinned: true,
snap: false,
actions: [
IconButton(
icon: Icon(Icons.save),
onPressed: () {
if (requestPermission(Permission.contacts) ?? false) {
contactDetails.saveNatively();
}
}),
IconButton(
icon: Icon(Icons.share),
onPressed: () {
shareContactToWhatsApp(VCard.fromContact(contactDetails));
})
],
expandedHeight: mq.size.height / 2.5,
flexibleSpace: FlexibleSpaceBar(
background: CustomPaint(
painter: ContactDetailSvg(
start: Point(
mq.size.width / 2, (mq.size.height / 2.5) / 2),
scale:
(mq.devicePixelRatio / mq.size.aspectRatio) * 1.5,
color: Theme.of(context).accentColor)),
title: Padding(
padding: EdgeInsets.only(right: mq.size.width / 4),
child: Text(
contactDetails.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
))),
SliverList(
delegate:
SliverChildListDelegate.fixed([contactMethods, contactInfo]),
)
],
));
} // build

/// Creates a [ContactCard] for the phone numbers, email address and
Expand Down Expand Up @@ -101,7 +105,7 @@ class ContactDetailPage extends StatelessWidget {
title: Text(data.phones[i].phone)));
}
}

//ensure all WhatsApp numbers are listed first
phoneNums.insertAll(0, phoneNumsWhatsApp);

Expand Down
8 changes: 6 additions & 2 deletions lib/screens/contact_screen/contact_view_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class ContactViewMobilePortrait extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Consumer<ThemeModel>(builder:(context, theme, child) => ContactViewStateful(state: ContactViewMobilePortraitState(themeModel: theme))));
body: Consumer<ThemeModel>(
builder: (context, theme, child) => ContactViewStateful(
state: ContactViewMobilePortraitState(themeModel: theme))));
}
}

Expand All @@ -18,6 +20,8 @@ class ContactViewMobileLandscape extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Consumer<ThemeModel>(builder: (context, theme, child) => ContactViewStateful(state: ContactViewMobileLandscapeState(themeModel: theme))));
body: Consumer<ThemeModel>(
builder: (context, theme, child) => ContactViewStateful(
state: ContactViewMobileLandscapeState(themeModel: theme))));
}
}
6 changes: 3 additions & 3 deletions lib/screens/contact_screen/contact_view_mobile_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ class ContactViewMobileLandscapeState extends ContactViewState {
Container(),
buildFixedContactListArea(
posFromTop: kToolbarHeight + topViewInsets,
height: mq.size.height - kToolbarHeight,
height: mq.size.height - kToolbarHeight - topViewInsets,
width: mq.size.width,
padH: mq.size.width * 0.05,
padV: mq.size.height * 0.05,
posFromLeft: 0.0,
),
Container(),
buildAppBarArea(
height: kToolbarHeight,
height: kToolbarHeight+topViewInsets,
animationIntervalStart: 0.0,
animationIntervalEnd: 1.0,
actions: <Widget>[
filterDropdown(context,
height: kToolbarHeight,
height: kToolbarHeight+topViewInsets,
width: mq.size.width / 3,
isExpanded: true,
elevation: 0.0),
Expand Down
1 change: 0 additions & 1 deletion lib/screens/contact_screen/contact_view_stateful.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
/// A single [StatefulWidget] to prevent code duplication for various screen layouts.
/// [state] is the state for the different screen layouts.
class ContactViewStateful extends StatefulWidget {

/// The [State] that this contact page should use.
final State<ContactViewStateful> state;

Expand Down
8 changes: 6 additions & 2 deletions lib/screens/contact_screen/contact_view_tablet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class ContactViewTabletPortrait extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Consumer<ThemeModel>(builder: (context, theme, child) => ContactViewStateful(state: ContactViewTabletPortraitState(themeModel: theme))));
body: Consumer<ThemeModel>(
builder: (context, theme, child) => ContactViewStateful(
state: ContactViewTabletPortraitState(themeModel: theme))));
}
}

Expand All @@ -18,6 +20,8 @@ class ContactViewTabletLandscape extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Consumer<ThemeModel>(builder: (context, theme, child) => ContactViewStateful(state: ContactViewTabletLandscapeState(themeModel: theme))));
body: Consumer<ThemeModel>(
builder: (context, theme, child) => ContactViewStateful(
state: ContactViewTabletLandscapeState(themeModel: theme))));
}
}
4 changes: 2 additions & 2 deletions lib/screens/contact_screen/contact_view_tablet_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ContactViewTabletLandscapeState extends ContactViewState {
),
Container(),
filterDrawer(
bgColor: Theme.of(context).accentColor,
bgColor: themeModel.selectedTheme == ThemeMode.dark? ElevationOverlay.applyOverlay(context,Theme.of(context).primaryColor , 2.0) : Theme.of(context).accentColor,
width: sidepanelWidth,
height: screenHeight - kToolbarHeight,
posFromTop: kToolbarHeight + topViewInsets),
Expand Down Expand Up @@ -101,7 +101,7 @@ class ContactViewTabletLandscapeState extends ContactViewState {
height: (height / categories.length) - ((height * 0.01) * 2),
decoration: BoxDecoration(
color: currentFilter == categories[i]['title']
? Color.lerp(Colors.blue[600], Colors.blue[700], 0.5)
? themeModel.selectedTheme == ThemeMode.dark? Theme.of(context).primaryColor : Color.lerp(Colors.blue[600], Colors.blue[700], 0.5)
: filterOptionBgColor,
borderRadius: BorderRadius.circular(40.0)),
child: ListTile(
Expand Down
1 change: 0 additions & 1 deletion lib/screens/homescreen/home_view_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:fst_app_flutter/widgets/app_drawer/app_drawer.dart';
import 'package:fst_app_flutter/widgets/card_container/card_container.dart';

class HomeMobilePortrait extends StatelessWidget {

@override
Widget build(BuildContext context) {
MediaQueryData queryData = MediaQuery.of(context);
Expand Down
9 changes: 5 additions & 4 deletions lib/utils/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class AppTheme {
primary: Color(0xFF003D8A),
primaryVariant: Color(0xFF00185C),
secondary: Color(0xFF1565BF),
secondaryVariant: Color(0xFF003C8E),
secondaryVariant: Color(0xFF003C8E),
surface: Colors.white,
background: Colors.white,
error: Color(0xFF931621),
Expand All @@ -20,7 +20,7 @@ class AppTheme {
primary: Color(0xff5578E2),
primaryVariant: Color(0xFF00185C),
secondary: Color(0xFF5E92F2),
secondaryVariant: Color(0xFF5E92F2),
secondaryVariant: Color(0xFF5E92F2),
surface: Color(0xff121212),
background: Color(0xff121212),
error: Color(0xffcf6679),
Expand All @@ -41,8 +41,9 @@ class AppTheme {

static String _fontFamily = 'Montserrat';

static ThemeData _darkTheme = ThemeData.from(
colorScheme: _darkColorScheme, textTheme: _textTheme.white).copyWith(toggleableActiveColor:_darkColorScheme.secondary);
static ThemeData _darkTheme =
ThemeData.from(colorScheme: _darkColorScheme, textTheme: _textTheme.white)
.copyWith(toggleableActiveColor: _darkColorScheme.secondary);

static ThemeData _lightTheme = ThemeData.from(
colorScheme: _lightColorScheme, textTheme: _textTheme.black);
Expand Down
8 changes: 4 additions & 4 deletions lib/utils/open_url.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:url_launcher/url_launcher.dart' as urlLauncher;

///Opens the specified [url] (which could be a website, email, phone call or sms) if possible, in the appropriate application.
///
/// To open a web page the [url] must be in the format:
///
///
/// To open a web page the [url] must be in the format:
///
/// `http:<URL>` OR `https:<URL>`
///
///
/// To send an email the [url] must be in the format: `mailto:<email address>`.
///
/// To make a call the [url] must be in the format: `tel:<phone number>`.
Expand Down
4 changes: 1 addition & 3 deletions lib/utils/precache_rive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'package:flare_flutter/flare_cache.dart';
import 'package:flare_flutter/provider/asset_flare.dart';
import 'package:flutter/services.dart';

const _filesToWarmup = [
'assets/rive_animated_icons/search_clear.flr'
];
const _filesToWarmup = ['assets/rive_animated_icons/search_clear.flr'];

Future<void> precacheRive() async {
for (final filename in _filesToWarmup) {
Expand Down
31 changes: 15 additions & 16 deletions lib/widgets/app_drawer/app_drawer_mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@ class AppDrawerMobileLayout extends StatelessWidget {
MediaQueryData queryData = MediaQuery.of(context);

return OrientationBuilder(
builder: (context, orientation) => Container(
width: orientation == Orientation.portrait
? 250
: queryData.size.width * 0.2,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
boxShadow: [
BoxShadow(
blurRadius: 16,
color: Colors.black12,
)
],
),
child:ListView(children: AppDrawer.getDrawerOptions()),
));

builder: (context, orientation) => Container(
width: orientation == Orientation.portrait
? 250
: queryData.size.width * 0.2,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
boxShadow: [
BoxShadow(
blurRadius: 16,
color: Colors.black12,
)
],
),
child: ListView(children: AppDrawer.getDrawerOptions()),
));
}
}
8 changes: 2 additions & 6 deletions lib/widgets/contact_widgets/contact_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,5 @@ class ContactCard extends Card {
{Key key,
@required this.child,
this.margin = const EdgeInsets.fromLTRB(2.0, 5.0, 2.0, 5.0)})
: super(
shape: Border(),
key: key,
child: child,
margin: margin);
} // ContactCard defintion
: super(shape: Border(), key: key, child: child, margin: margin);
} // ContactCard defintion
Loading

0 comments on commit 07a5c87

Please sign in to comment.