add new widget by Elham Rababah and Mohammad Aljammal

merge-requests/1/head
Mohammad Aljammal 5 years ago
parent 19676549e1
commit 6d6c71655a

@ -31,15 +31,11 @@ class SizeConfig {
if (realScreenWidth < 450) {
isMobilePortrait = true;
}
// textMultiplier = _blockHeight;
// imageSizeMultiplier = _blockWidth;
screenHeight = realScreenHeight;
screenWidth = realScreenWidth;
} else {
isPortrait = false;
isMobilePortrait = false;
// textMultiplier = _blockWidth;
// imageSizeMultiplier = _blockHeight;
screenHeight = realScreenWidth;
screenWidth = realScreenHeight;
}

@ -59,7 +59,7 @@ class MyApp extends StatelessWidget {
backgroundColor: Color.fromRGBO(255, 255, 255, 1),
highlightColor: Colors.grey[100].withOpacity(0.4),
splashColor: Colors.transparent,
primaryColor: Color.fromRGBO(78, 62, 253, 1.0),
primaryColor: Colors.grey,
cursorColor: Color.fromRGBO(78, 62, 253, 1.0),
iconTheme:IconThemeData(

@ -0,0 +1,82 @@
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class LargeAvatar extends StatelessWidget {
LargeAvatar(
{Key key,
this.name,
this.url,
this.disableProfileView: false,
this.radius = 60.0,
this.width = 90,
this.height = 90})
: super(key: key);
final String name;
final String url;
final bool disableProfileView;
final double radius;
final double width;
final double height;
Widget _getAvatar() {
if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) {
return Center(
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(radius)),
child: Image.network(
url.trim(),
fit: BoxFit.cover,
width: width,
height: height,
),
),
);
} else if (name == null || name.isEmpty) {
return Center(
child: Texts(
'DR',
color: Colors.white,
));
} else {
return Center(
child: Texts(
name[0].toUpperCase(),
color: Colors.white,
fontSize: 18,
));
}
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: disableProfileView
? null
: () {
//TODO when we need that
},
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(-1, -1),
end: Alignment(1, 1),
colors: [
Colors.grey[100],
Colors.grey[800],
]),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(0, 0, 0, 0.08),
offset: Offset(0.0, 5.0),
blurRadius: 16.0)
],
borderRadius: BorderRadius.all(Radius.circular(50.0)),
),
width: width,
height: height,
child: _getAvatar()),
);
}
}

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:charts_flutter/flutter.dart' as charts;
/// chart line
/// [seriesList] charts series
/// [chartTitle] the charts title
/// [animate] enable and disable animate on create chart
/// [includeArea] chart include Area
/// [stacked] stacked chart over the design
class AppLineChart extends StatelessWidget {
final List<charts.Series> seriesList;
final String chartTitle;
final bool animate;
final bool includeArea;
final bool stacked;
AppLineChart(
{Key key,
@required this.seriesList,
this.chartTitle,
this.animate = true,
this.includeArea = false,
this.stacked = true});
@override
Widget build(BuildContext context) {
return Container(
child: Column(
children: <Widget>[
Text(
chartTitle,
style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
),
Expanded(
child: charts.LineChart(seriesList,
defaultRenderer: charts.LineRendererConfig(
includeArea: false, stacked: true),
animate: animate),
),
],
),
);
}
}

@ -0,0 +1,64 @@
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:charts_flutter/flutter.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/widgets/data_display/list/ListContainer.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
/// App Time Series Chart
/// [seriesList] the series list
/// [chartName] the name of the chart
/// [startDate] the start date
/// [endDate] the end date
class AppTimeSeriesChart extends StatelessWidget {
AppTimeSeriesChart({
Key key,
@required this.seriesList,
this.chartName = '',
this.startDate,
this.endDate,
});
final String chartName;
final List<Series<dynamic, DateTime>> seriesList;
final DateTime startDate;
final DateTime endDate;
@override
Widget build(BuildContext context) {
return ListContainer(
heightFactor: 0.47,
child: Column(
children: <Widget>[
Texts(chartName, fontSize: SizeConfig.textMultiplier * 3),
Container(
height: SizeConfig.realScreenHeight * 0.37,
child: Center(
child: Container(
child: charts.TimeSeriesChart(
seriesList,
animate: true,
behaviors: [
charts.RangeAnnotation(
[
charts.RangeAnnotationSegment(startDate, endDate,
charts.RangeAnnotationAxisType.domain),
],
),
],
),
),
),
),
],
),
);
}
}
class TimeSeriesSales {
final DateTime time;
final int sales;
TimeSeriesSales(this.time, this.sales);
}

@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
/// [child] A widget that centers its child within itself.
/// [padding] The amount of space by which to inset the child.
/// [color] By default, the color is derived from the [type] of material.
/// [radius] radius value
class CardRoundedWidget extends StatelessWidget {
final Widget child;
final double padding;
final Color color;
final double radius;
CardRoundedWidget(
{@required this.child,
this.color = Colors.white,
this.radius = 10.0,
this.padding = 10.0});
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(vertical: 10.0),
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(radius),
),
),
child: Material(
borderRadius: BorderRadius.all(Radius.circular(radius)),
color: color,
child: Stack(
children: [
Center(
child: Container(
child: Padding(
padding: EdgeInsets.all(padding),
child: Center(child: child),
)),
)
],
),
),
);
}
}

@ -1,17 +1,24 @@
import 'package:flutter/material.dart';
class ListContainer extends StatelessWidget {
final double size;
final double widthFactor;
final double heightFactor;
final EdgeInsets padding;
final Widget child;
ListContainer({Key key, this.size, this.padding, this.child})
: super(key: key);
ListContainer({
Key key,
this.widthFactor = 0.9,
this.heightFactor = 1,
this.padding,
this.child,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return FractionallySizedBox(
widthFactor: size ?? 0.9,
widthFactor: widthFactor,
heightFactor: heightFactor,
child: ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Material(

@ -0,0 +1,24 @@
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
///show App Embedded Error
/// [error] the message we show to the user
class AppEmbeddedError extends StatelessWidget {
const AppEmbeddedError({
Key key,
@required this.error,
}) : super(key: key);
final String error;
@override
Widget build(BuildContext context) {
return Center(
child: Texts(
error,
color: Theme.of(context).errorColor,
textAlign: TextAlign.center,
),
);
}
}

@ -0,0 +1,65 @@
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
/// App Expandable Notifier with animation
/// [headerWidget] widget want to show in the header
/// [bodyWidget] widget want to show in the body
/// [title] the widget title
/// [collapsed] The widget shown in the collapsed state
class AppExpandableNotifier extends StatelessWidget {
final Widget headerWidget;
final Widget bodyWidget;
final String title;
final Widget collapsed;
AppExpandableNotifier(
{this.headerWidget, this.bodyWidget, this.title, this.collapsed});
@override
Widget build(BuildContext context) {
return ExpandableNotifier(
child: Padding(
padding: const EdgeInsets.all(10),
child: Card(
clipBehavior: Clip.antiAlias,
child: Column(
children: <Widget>[
SizedBox(
child: headerWidget,
),
ScrollOnExpand(
scrollOnExpand: true,
scrollOnCollapse: false,
child: ExpandablePanel(
theme: const ExpandableThemeData(
headerAlignment: ExpandablePanelHeaderAlignment.center,
tapBodyToCollapse: true,
),
header: Padding(
padding: EdgeInsets.all(10),
child: Text(
title,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
collapsed: collapsed,
expanded: bodyWidget,
builder: (_, collapsed, expanded) {
return Padding(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
child: Expandable(
collapsed: collapsed,
expanded: expanded,
theme: const ExpandableThemeData(crossFadePoint: 0),
),
);
},
),
),
],
),
),
),
);
}
}

@ -1,10 +1,10 @@
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/providers/project_provider.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'arrow_back.dart';
import 'file:///D:/Mohammad/diplomatic_quarter_app/lib/widgets/progress_indicator/app_loader_widget.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
class AppScaffold extends StatelessWidget {
@ -36,11 +36,7 @@ class AppScaffold extends StatelessWidget {
title: Text(appBarTitle.toUpperCase()),
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.white,
onPressed: () => Navigator.pop(context),
);
return ArrowBack();
},
),
centerTitle: true,

Loading…
Cancel
Save