Commit ac684dde authored by Dasun Madushanka's avatar Dasun Madushanka

intergrated Application

parent 61ca1a98
# Furniture App - Flutter UI
## [Watch it on YouTube](https://youtu.be/bkR7naR1efA)
**Packages we are using:**
......@@ -12,9 +11,6 @@
- Poppins [link](https://fonts.google.com/specimen/Poppins)
We design two pages one is the product page and another one is details page that will help you to design clear interfaces for Furniture faster and easier.
### Furniture App Final UI
![Preview](/gif.gif)
##App Final UI
![App UI](/food_app.png)
![App UI](/ui.png)
\ No newline at end of file
......@@ -39,11 +39,15 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.furniture_app"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
aaptOptions {
noCompress 'tflite'
noCompress 'lite'
}
buildTypes {
release {
......
......@@ -7,7 +7,7 @@
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="furniture_app"
android:label="CIAT"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
......
0 Four Years Old
1 Three Years Old
2 Five Years Old
3 Six Years Old
4 Seven Years Old
5 Eight Years Old
6 Fail(1 out of 5)
7 Fail(2 out of 5)
8 Pass(3 out of 5)
9 Pass(4 out of 5)
10 Pass(5 out of 5)
11 No Marks
12 High Concentration(8 out of 8)
13 Low Concentration(1 out of 8)
14 Low Concentration(2 out of 8)
15 Low Concentration(3 out of 8)
16 Low Concentration(6 out of 8)
17 Medium Concentration(4 out of 8)
18 Medium Concentration(5 out of 8)
19 High Intelligence(Square,more than 80%)
20 Medium Intelligence(Square,between 40% & 80%)
21 High Intelligence(Triangle,more than 80%)
22 Medium Intelligence(Triangle,between 40% & 80%)
23 Low Intelligence(between 0% & 40%)
This image diff could not be displayed because it is too large. You can view the blob instead.
import 'package:flutter/material.dart';
import 'package:furniture_app/constants.dart';
import 'package:furniture_app/screens/product/products_screen.dart';
import 'package:DMTI_app/screens/details/dmt_crash.dart';
import 'package:DMTI_app/screens/product/products_screen.dart';
import 'package:flutter/material.dart'; //import 'package:furniture_app/constants.dart';
//import 'package:furniture_app/screens/product/products_screen.dart';
import 'package:google_fonts/google_fonts.dart';
import 'constants.dart';
void main() {
runApp(MyApp());
}
......@@ -13,7 +16,7 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Furniture app',
title: 'CIAT app',
theme: ThemeData(
// We set Poppins as our default font
textTheme: GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme),
......@@ -22,6 +25,7 @@ class MyApp extends StatelessWidget {
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: ProductsScreen(),
routes: {DMTCrash.routeName: (context) => DMTCrash()},
);
}
}
......@@ -10,25 +10,33 @@ class Product {
List<Product> products = [
Product(
id: 1,
price: 56,
title: "Classic Leather Arm Chair",
image: "assets/images/Item_1.png",
price: 20,
title: "Draw Man Test",
image: "assets/images/test2.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
"The Draw-a-Person test is a psychological projective personality or cognitive test used to evaluate children and adolescents for a variety of purposes",
),
Product(
id: 4,
price: 68,
title: "Poppy Plastic Tub Chair",
image: "assets/images/Item_2.png",
price: 15,
title: "Shape Test",
image: "assets/images/test1.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
),
Product(
id: 9,
price: 39,
title: "Bar Stool Chair",
image: "assets/images/Item_3.png",
price: 30,
title: "Arithmatic Test",
image: "assets/images/test3.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
),
Product(
id: 29,
price: 30,
title: "Number Cancellation Test",
image: "assets/images/test4.png",
description:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim",
),
......
import 'package:flutter/material.dart';
class EmptyState extends StatelessWidget {
final String title, message, age, mage;
EmptyState({this.title, this.message, this.age, this.mage});
@override
Widget build(BuildContext context) {
return Material(
borderRadius: BorderRadius.circular(20),
elevation: 16,
color: Theme.of(context).cardColor.withOpacity(.95),
shadowColor: Theme.of(context).accentColor.withOpacity(.5),
child: Padding(
padding: EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(title, style: Theme.of(context).textTheme.headline2),
Padding(
padding: EdgeInsets.all(8.0),
child: Text(message),
),
],
),
),
);
}
}
import 'package:DMTI_app/screens/Form/user.dart';
import 'package:flutter/material.dart';
typedef OnDelete();
class UserForm extends StatefulWidget {
final User user;
final state = _UserFormState();
final OnDelete onDelete;
UserForm({Key key, this.user, this.onDelete}) : super(key: key);
@override
_UserFormState createState() => state;
bool isValid() => state.validate();
}
class _UserFormState extends State<UserForm> {
final form = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(16),
child: Material(
elevation: 1,
clipBehavior: Clip.antiAlias,
borderRadius: BorderRadius.circular(8),
child: Form(
key: form,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
AppBar(
leading: Icon(Icons.verified_user),
elevation: 0,
title: Text('User Details'),
backgroundColor: Theme.of(context).accentColor,
centerTitle: true,
actions: <Widget>[
IconButton(
icon: Icon(Icons.delete),
onPressed: widget.onDelete,
)
],
),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 16),
child: TextFormField(
initialValue: widget.user.fullName,
onSaved: (val) => widget.user.fullName = val,
validator: (val) =>
val.length > 3 ? null : 'Full name is invalid',
decoration: InputDecoration(
labelText: 'Full Name',
hintText: 'Enter your full name',
icon: Icon(Icons.person),
isDense: true,
),
),
),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 24),
child: TextFormField(
initialValue: widget.user.email,
onSaved: (val) => widget.user.email = val,
validator: (val) =>
val.contains('@') ? null : 'Email is invalid',
decoration: InputDecoration(
labelText: 'Email Address',
hintText: 'Enter your email',
icon: Icon(Icons.email),
isDense: true,
),
),
),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 16),
child: TextFormField(
initialValue: widget.user.age,
onSaved: (val) => widget.user.age = val,
validator: (val) => val.length > 3 ? null : 'Age is invalid',
decoration: InputDecoration(
labelText: '4 years',
hintText: 'Enter Actual Age',
icon: Icon(Icons.child_care),
isDense: true,
),
),
),
Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 16),
child: TextFormField(
initialValue: widget.user.mentalage,
onSaved: (val) => widget.user.mentalage = val,
validator: (val) =>
val.length > 3 ? null : 'Mental age is invalid',
decoration: InputDecoration(
labelText: '4 years',
hintText: 'Enter Mental age',
icon: Icon(Icons.score),
isDense: true,
),
),
)
],
),
),
),
);
}
///form validator
bool validate() {
var valid = form.currentState.validate();
if (valid) form.currentState.save();
return valid;
}
}
import 'package:flutter/material.dart';
import 'multi_form.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Forms',
theme: ThemeData(
primarySwatch: Colors.blue,
accentColor: Color(0xFF1DCC8C),
platform: TargetPlatform.iOS,
),
debugShowCheckedModeBanner: false,
home: MultiForm(),
);
}
}
import 'package:DMTI_app/screens/Form/user.dart';
import 'package:DMTI_app/screens/product/products_screen.dart';
import 'package:flutter/material.dart';
import 'empty_state.dart';
import 'form.dart';
class MultiForm extends StatefulWidget {
@override
_MultiFormState createState() => _MultiFormState();
}
class _MultiFormState extends State<MultiForm> {
List<UserForm> users = [];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: .0,
leading: IconButton(
onPressed: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (c) => ProductsScreen()));
},
icon: Icon(
Icons.home,
),
),
title: Text('Patients Records'),
actions: <Widget>[
FlatButton(
child: Text('Save'),
textColor: Colors.white,
onPressed: onSave,
)
],
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0xFF30C1FF),
Color(0xFF2AA7DC),
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: users.length <= 0
? Center(
child: EmptyState(
title: 'No Records',
message: 'Add form by tapping add button below',
),
)
: ListView.builder(
addAutomaticKeepAlives: true,
itemCount: users.length,
itemBuilder: (_, i) => users[i],
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.add),
onPressed: onAddForm,
foregroundColor: Colors.white,
),
);
}
///on form user deleted
void onDelete(User _user) {
setState(() {
var find = users.firstWhere(
(it) => it.user == _user,
orElse: () => null,
);
if (find != null) users.removeAt(users.indexOf(find));
});
}
///on add form
void onAddForm() {
setState(() {
var _user = User();
users.add(UserForm(
user: _user,
onDelete: () => onDelete(_user),
));
});
}
///on save forms
void onSave() {
if (users.length > 0) {
var allValid = true;
users.forEach((form) => allValid = allValid && form.isValid());
if (allValid) {
var data = users.map((it) => it.user).toList();
Navigator.push(
context,
MaterialPageRoute(
fullscreenDialog: true,
builder: (_) => Scaffold(
appBar: AppBar(
title: Text('List of Users'),
),
body: ListView.builder(
itemCount: data.length,
itemBuilder: (_, i) => ListTile(
leading: CircleAvatar(
child: Text(data[i].fullName.substring(0, 1)),
),
title: Text(data[i].fullName),
subtitle: Text(
data[i].mentalage,
),
),
),
),
),
);
}
}
}
}
class User {
String fullName;
String email;
String age;
String mentalage;
User(
{this.fullName = '',
this.email = '',
this.age = '',
this.mentalage = ''});
}
library painter;
import 'package:flutter/material.dart' as mat show Image;
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart' hide Image;
import 'dart:ui';
import 'dart:async';
import 'dart:typed_data';
class Painter extends StatefulWidget {
final PainterController painterController;
Painter(PainterController painterController)
: this.painterController = painterController,
super(key: ValueKey<PainterController>(painterController));
@override
_PainterState createState() => _PainterState();
}
class _PainterState extends State<Painter> {
final GlobalKey _globalKey = GlobalKey();
@override
void initState() {
super.initState();
widget.painterController._globalKey = _globalKey;
}
@override
Widget build(BuildContext context) {
Widget child = CustomPaint(
willChange: true,
painter: _PainterPainter(widget.painterController._pathHistory,
repaint: widget.painterController),
);
child = ClipRect(child: child);
if (widget.painterController.backgroundImage == null) {
child = RepaintBoundary(
key: _globalKey,
child: GestureDetector(
child: child,
onPanStart: _onPanStart,
onPanUpdate: _onPanUpdate,
onPanEnd: _onPanEnd,
),
);
} else {
child = RepaintBoundary(
key: _globalKey,
child: Stack(
alignment: FractionalOffset.center,
fit: StackFit.expand,
children: <Widget>[
widget.painterController.backgroundImage,
GestureDetector(
child: child,
onPanStart: _onPanStart,
onPanUpdate: _onPanUpdate,
onPanEnd: _onPanEnd,
)
],
),
);
}
return Container(
child: child,
width: double.infinity,
height: double.infinity,
);
}
void _onPanStart(DragStartDetails start) {
Offset pos = (context.findRenderObject() as RenderBox)
.globalToLocal(start.globalPosition);
widget.painterController._pathHistory.add(pos);
widget.painterController._notifyListeners();
}
void _onPanUpdate(DragUpdateDetails update) {
Offset pos = (context.findRenderObject() as RenderBox)
.globalToLocal(update.globalPosition);
widget.painterController._pathHistory.updateCurrent(pos);
widget.painterController._notifyListeners();
}
void _onPanEnd(DragEndDetails end) {
widget.painterController._pathHistory.endCurrent();
widget.painterController._notifyListeners();
}
}
class _PainterPainter extends CustomPainter {
final _PathHistory _path;
_PainterPainter(this._path, {Listenable repaint}) : super(repaint: repaint);
@override
void paint(Canvas canvas, Size size) {
_path.draw(canvas, size);
}
@override
bool shouldRepaint(_PainterPainter oldDelegate) => true;
}
class _PathHistory {
List<MapEntry<Path, Paint>> _paths;
List<MapEntry<Path, Paint>> _undone;
Paint currentPaint;
Paint _backgroundPaint;
bool _inDrag;
double _startX; //start X with a tap
double _startY; //start Y with a tap
bool _startFlag = false;
bool _erase = false;
double _eraseArea = 1.0;
bool _pathFound = false;
_PathHistory() {
_paths = List<MapEntry<Path, Paint>>();
_undone = List<MapEntry<Path, Paint>>();
_inDrag = false;
_backgroundPaint = Paint();
}
bool canUndo() => _paths.length > 0;
bool get erase => _erase;
set erase(bool e) {
_erase = e;
}
set eraseArea(double r) {
_eraseArea = r;
}
void undo() {
if (!_inDrag && canUndo()) {
_undone.add(_paths.removeLast());
}
}
bool canRedo() => _undone.length > 0;
void redo() {
if (!_inDrag && canRedo()) {
_paths.add(_undone.removeLast());
}
}
void clear() {
if (!_inDrag) {
_paths.clear();
_undone.clear();
}
}
set backgroundColor(color) => _backgroundPaint.color = color;
void add(Offset startPoint) {
if (!_inDrag) {
_inDrag = true;
Path path = Path();
path.moveTo(startPoint.dx, startPoint.dy);
_startX = startPoint.dx;
_startY = startPoint.dy;
_startFlag = true;
_paths.add(MapEntry<Path, Paint>(path, currentPaint));
}
}
void updateCurrent(Offset nextPoint) {
if (_inDrag) {
_pathFound = false;
if (!_erase) {
Path path = _paths.last.key;
path.lineTo(nextPoint.dx, nextPoint.dy);
_startFlag = false;
} else {
for (int i = 0; i < _paths.length; i++) {
_pathFound = false;
for (double x = nextPoint.dx - _eraseArea;
x <= nextPoint.dx + _eraseArea;
x++) {
for (double y = nextPoint.dy - _eraseArea;
y <= nextPoint.dy + _eraseArea;
y++) {
if (_paths[i].key.contains(new Offset(x, y))) {
_undone.add(_paths.removeAt(i));
i--;
_pathFound = true;
break;
}
}
if (_pathFound) {
break;
}
}
}
}
}
}
void endCurrent() {
Path path = _paths.last.key;
if ((_startFlag) && (!_erase)) {
//if it was just a tap, draw a point and reset a flag
path.addOval(
Rect.fromCircle(center: new Offset(_startX, _startY), radius: 1.0));
_startFlag = false;
}
_inDrag = false;
}
void draw(Canvas canvas, Size size) {
canvas.drawRect(
Rect.fromLTWH(0.0, 0.0, size.width, size.height), _backgroundPaint);
for (MapEntry<Path, Paint> path in _paths) {
canvas.drawPath(path.key, path.value);
}
}
}
class PainterController extends ChangeNotifier {
Color _drawColor = Color.fromARGB(255, 0, 0, 0);
Color _backgroundColor = Color.fromARGB(255, 255, 255, 255);
mat.Image _bgimage;
double _thickness = 1.0;
double _erasethickness = 1.0;
_PathHistory _pathHistory;
GlobalKey _globalKey;
PainterController() {
_pathHistory = _PathHistory();
}
Color get drawColor => _drawColor;
set drawColor(Color color) {
_drawColor = color;
_updatePaint();
}
Color get backgroundColor => _backgroundColor;
set backgroundColor(Color color) {
_backgroundColor = color;
_updatePaint();
}
mat.Image get backgroundImage => _bgimage;
set backgroundImage(mat.Image image) {
_bgimage = image;
_updatePaint();
}
double get thickness => _thickness;
set thickness(double t) {
_thickness = t;
_updatePaint();
}
double get erasethickness => _erasethickness;
set erasethickness(double t) {
_erasethickness = t;
_pathHistory._eraseArea = t;
_updatePaint();
}
bool get eraser => _pathHistory.erase; //setter / getter for eraser
set eraser(bool e) {
_pathHistory.erase = e;
_pathHistory._eraseArea = _erasethickness;
_updatePaint();
}
void _updatePaint() {
Paint paint = Paint();
paint.color = drawColor;
paint.style = PaintingStyle.stroke;
paint.strokeWidth = thickness;
_pathHistory.currentPaint = paint;
if (_bgimage != null) {
_pathHistory.backgroundColor = Color(0x00000000);
} else {
_pathHistory.backgroundColor = _backgroundColor;
}
notifyListeners();
}
void undo() {
_pathHistory.undo();
notifyListeners();
}
void redo() {
_pathHistory.redo();
notifyListeners();
}
bool get canUndo => _pathHistory.canUndo();
bool get canRedo => _pathHistory.canRedo();
void _notifyListeners() {
notifyListeners();
}
void clear() {
_pathHistory.clear();
notifyListeners();
}
Future<Uint8List> exportAsPNGBytes() async {
RenderRepaintBoundary boundary =
_globalKey.currentContext.findRenderObject();
Image image = await boundary.toImage();
ByteData byteData = await image.toByteData(format: ImageByteFormat.png);
return byteData.buffer.asUint8List();
}
}
import 'package:flutter/material.dart';
import 'package:painter2/painter2.dart';
import 'dart:typed_data';
class ExamplePage extends StatefulWidget {
@override
_ExamplePageState createState() => new _ExamplePageState();
}
class _ExamplePageState extends State<ExamplePage> {
bool _finished;
PainterController _controller;
@override
void initState() {
super.initState();
_finished = false;
_controller = newController();
}
PainterController newController() {
PainterController controller = PainterController();
controller.thickness = 5.0;
controller.backgroundColor = Colors.green;
controller.backgroundImage = Image.network(
'https://cdn-images-1.medium.com/max/1200/1*5-aoK8IBmXve5whBQM90GA.png');
return controller;
}
@override
Widget build(BuildContext context) {
List<Widget> actions;
if (_finished) {
actions = <Widget>[
IconButton(
icon: Icon(Icons.content_copy),
tooltip: 'New Painting',
onPressed: () => setState(() {
_finished = false;
_controller = newController();
}),
),
];
} else {
actions = <Widget>[
IconButton(
icon: Icon(Icons.undo),
tooltip: 'Undo',
onPressed: () {
if (_controller.canUndo) _controller.undo();
},
),
IconButton(
icon: Icon(Icons.redo),
tooltip: 'Redo',
onPressed: () {
if (_controller.canRedo) _controller.redo();
},
),
IconButton(
icon: Icon(Icons.delete),
tooltip: 'Clear',
onPressed: () => _controller.clear(),
),
IconButton(
icon: Icon(Icons.check),
onPressed: () async {
setState(() {
_finished = true;
});
Uint8List bytes = await _controller.exportAsPNGBytes();
Navigator.of(context)
.push(MaterialPageRoute(builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('View your image'),
),
body: Container(
child: Image.memory(bytes),
),
);
}));
}),
];
}
return Scaffold(
appBar: AppBar(
title: Text('Painter2 Example'),
actions: actions,
bottom: PreferredSize(
child: DrawBar(_controller),
preferredSize: Size(MediaQuery.of(context).size.width, 30.0),
)),
body: Center(
child: AspectRatio(aspectRatio: 1.0, child: Painter(_controller))),
);
}
}
class DrawBar extends StatelessWidget {
final PainterController _controller;
DrawBar(this._controller);
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Flexible(child: StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Container(
child: Slider(
value: _controller.thickness,
onChanged: (value) => setState(() {
_controller.thickness = value;
}),
min: 1.0,
max: 20.0,
activeColor: Colors.white,
));
})),
ColorPickerButton(_controller, false),
ColorPickerButton(_controller, true),
],
);
}
}
class ColorPickerButton extends StatefulWidget {
final PainterController _controller;
final bool _background;
ColorPickerButton(this._controller, this._background);
@override
_ColorPickerButtonState createState() => new _ColorPickerButtonState();
}
class _ColorPickerButtonState extends State<ColorPickerButton> {
@override
Widget build(BuildContext context) {
return IconButton(
icon: Icon(_iconData, color: _color),
tooltip:
widget._background ? 'Change background color' : 'Change draw color',
onPressed: () => _pickColor(),
);
}
void _pickColor() {
Color pickerColor = _color;
Navigator.of(context)
.push(MaterialPageRoute(
fullscreenDialog: true,
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Pick color'),
),
body: Container());
}))
.then((_) {
setState(() {
_color = pickerColor;
});
});
}
Color get _color => widget._background
? widget._controller.backgroundColor
: widget._controller.drawColor;
IconData get _iconData =>
widget._background ? Icons.format_color_fill : Icons.brush;
set _color(Color color) {
if (widget._background) {
widget._controller.backgroundColor = color;
} else {
widget._controller.drawColor = color;
}
}
}
import 'dart:async';
import 'package:flutter/material.dart';
class TimerCard extends StatefulWidget {
const TimerCard({Key key}) : super(key: key);
@override
TimerCardState createState() => TimerCardState();
}
class TimerCardState extends State<TimerCard> {
// The timer's value shown on app's UI.
int _timerValue = 0;
bool _paused = true;
// A stream that updates every second. The stream's value is the number of
// seconds elapsed since the app is started. We simply print this stream value
// out in command-line. The value shown on UI is this._timerValue.
final Stream<int> _periodicStream =
Stream.periodic(Duration(milliseconds: 1000), (i) => i);
// Record of the latest stream value that we saw. Because the StreamBuilder is
// rebuilt when we call setState(), and in the re-build we shouldn't increment
// this._timerValue if the latest snapshot's value hasn't changed.
int _previousStreamValue = 0;
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
margin: EdgeInsets.all(8),
child: StreamBuilder(
stream: this._periodicStream,
builder: (BuildContext context, AsyncSnapshot<int> snapshot) {
if (snapshot.hasData) {
if (snapshot.data != this._previousStreamValue) {
print('Latest snapshot from stream: ${snapshot.data}');
this._previousStreamValue = snapshot.data;
if (!_paused) {
this._timerValue++;
}
}
}
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Card(child: _buildTimerUI()),
],
);
},
),
);
}
Widget _buildTimerUI() {
return Column(
children: <Widget>[
Text(
'$_timerValue',
style: Theme.of(context).textTheme.headline4,
),
ButtonBar(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(this._paused ? Icons.play_arrow : Icons.pause),
onPressed: () => setState(() => this._paused = !this._paused),
),
IconButton(
icon: Icon(Icons.stop),
onPressed: () => setState(
() {
this._timerValue = 0;
this._paused = true;
},
),
),
],
),
],
);
}
}
import 'package:DMTI_app/constants.dart';
import 'package:DMTI_app/models/product.dart';
import 'package:flutter/material.dart';
import 'package:furniture_app/constants.dart';
import 'package:furniture_app/models/product.dart';
import 'chat_and_add_to_cart.dart';
import 'list_of_colors.dart';
......@@ -53,7 +53,7 @@ class Body extends StatelessWidget {
),
),
Text(
'\$${product.price}',
'${product.price} \M\I\N',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
......
import 'package:DMTI_app/screens/details/dmt_crash.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
......@@ -18,7 +19,7 @@ class ChatAndAddToCart extends StatelessWidget {
),
decoration: BoxDecoration(
color: Color(0xFFFCBF1E),
borderRadius: BorderRadius.circular(30),
borderRadius: BorderRadius.circular(40),
),
child: Row(
children: <Widget>[
......@@ -28,19 +29,21 @@ class ChatAndAddToCart extends StatelessWidget {
),
SizedBox(width: kDefaultPadding / 2),
Text(
"Chat",
"Review the Exam",
style: TextStyle(color: Colors.white),
),
// it will cover all available spaces
Spacer(),
FlatButton.icon(
onPressed: () {},
onPressed: () {
Navigator.of(context).pushNamed(DMTCrash.routeName);
},
icon: SvgPicture.asset(
"assets/icons/shopping-bag.svg",
" ",
height: 18,
),
label: Text(
"Add to Cart",
"20 MIN",
style: TextStyle(color: Colors.white),
),
),
......
......@@ -24,7 +24,7 @@ class ColorDot extends StatelessWidget {
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: isSelected ? Color(0xFF707070) : Colors.transparent,
color: isSelected ? Color(0xFF80989A) : Colors.transparent,
),
),
child: Container(
......
import 'package:DMTI_app/models/product.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:furniture_app/constants.dart';
import 'package:furniture_app/models/product.dart';
import '../../constants.dart';
import 'components/body.dart';
class DetailsScreen extends StatelessWidget {
......@@ -38,7 +38,7 @@ class DetailsScreen extends StatelessWidget {
),
actions: <Widget>[
IconButton(
icon: SvgPicture.asset('assets/icons/cart_with_item.svg'),
icon: SvgPicture.asset('assets/icons/notification.svg'),
onPressed: () {},
),
],
......
import 'dart:io';
import 'package:DMTI_app/screens/Form/multi_form.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite/tflite.dart';
class DMTCrash extends StatefulWidget {
static const routeName = "dmt_crash";
@override
_DMTCrashState createState() => _DMTCrashState();
}
class _DMTCrashState extends State<DMTCrash> {
List _outputs;
File _image;
bool _loading = false;
@override
void initState() {
super.initState();
_loading = true;
loadModel().then((value) {
setState(() {
_loading = false;
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Test Results'),
actions: [
FlatButton(
child: Text('Next'),
textColor: Colors.white,
onPressed: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => MultiForm()));
},
)
],
),
body: _loading
? Container(
alignment: Alignment.center,
child: CircularProgressIndicator(),
)
: Container(
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
_image == null ? Container() : Image.file(_image),
SizedBox(
height: 20,
),
_outputs != null
? Text(
"${_outputs[0]["label"]}",
style: TextStyle(
color: Colors.black,
fontSize: 20.0,
background: Paint()..color = Colors.white,
),
)
: Container()
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: pickImage,
child: Icon(Icons.image),
),
);
}
pickImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
if (image == null) return null;
setState(() {
_loading = true;
_image = image;
});
classifyImage(image);
}
classifyImage(File image) async {
var output = await Tflite.runModelOnImage(
path: image.path,
numResults: 2,
threshold: 0.5,
imageMean: 127.5,
imageStd: 127.5,
);
setState(() {
_loading = false;
_outputs = output;
});
}
loadModel() async {
await Tflite.loadModel(
model: "assets/model_unquant.tflite",
labels: "assets/labels.txt",
);
}
@override
void dispose() {
Tflite.close();
super.dispose();
}
}
import 'package:DMTI_app/components/search_box.dart';
import 'package:DMTI_app/constants.dart';
import 'package:DMTI_app/models/product.dart';
import 'package:DMTI_app/screens/Painter/painter_view.dart';
import 'package:DMTI_app/screens/Timercard/timercard.dart';
import 'package:DMTI_app/screens/details/details_screen.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:furniture_app/components/search_box.dart';
import 'package:furniture_app/constants.dart';
import 'package:furniture_app/models/product.dart';
import 'package:furniture_app/screens/details/details_screen.dart';
import 'package:flutter/painting.dart';
import 'category_list.dart';
import 'product_card.dart';
......@@ -26,29 +30,50 @@ class Body extends StatelessWidget {
decoration: BoxDecoration(
color: kBackgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(40),
topRight: Radius.circular(40),
topLeft: Radius.circular(50),
topRight: Radius.circular(50),
),
),
),
ListView.builder(
// here we use our demo procuts list
itemCount: products.length,
itemBuilder: (context, index) => ProductCard(
itemIndex: index,
product: products[index],
press: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DetailsScreen(
product: products[index],
),
),
// here we use our demo procuts list
itemCount: products.length + 1,
itemBuilder: (context, index) {
if (index == products.length) {
return Card(
margin: EdgeInsets.symmetric(
horizontal: 20, vertical: 24),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24)),
color: Colors.grey,
child: TimerCard(),
);
}
// if (index == products.length + 1) {
// return Card(
// margin: EdgeInsets.symmetric(
// horizontal: 20, vertical: 24),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(24)),
// color: Colors.grey,
// child: (),
// );
// }
return ProductCard(
itemIndex: index,
product: products[index],
press: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DetailsScreen(
product: products[index],
),
),
);
},
);
},
),
)
})
],
),
),
......
......@@ -11,7 +11,7 @@ class CategoryList extends StatefulWidget {
class _CategoryListState extends State<CategoryList> {
// by default first item will be selected
int selectedIndex = 0;
List categories = ['All', 'Sofa', 'Park bench', 'Armchair'];
List categories = ['All', 'Tests'];
@override
Widget build(BuildContext context) {
return Container(
......
import 'package:DMTI_app/models/product.dart';
import 'package:flutter/material.dart';
import 'package:furniture_app/models/product.dart';
import '../../../constants.dart';
......@@ -35,15 +35,15 @@ class ProductCard extends StatelessWidget {
Container(
height: 136,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22),
borderRadius: BorderRadius.circular(18),
color: itemIndex.isEven ? kBlueColor : kSecondaryColor,
boxShadow: [kDefaultShadow],
),
child: Container(
margin: EdgeInsets.only(right: 10),
margin: EdgeInsets.only(right: 40),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(22),
color: Colors.white70,
borderRadius: BorderRadius.circular(18),
),
),
),
......@@ -100,7 +100,7 @@ class ProductCard extends StatelessWidget {
),
),
child: Text(
"\$${product.price}",
"${product.price} \M\I\N",
style: Theme.of(context).textTheme.button,
),
),
......
import 'package:DMTI_app/constants.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:furniture_app/constants.dart';
import 'components/body.dart';
......@@ -18,7 +18,7 @@ class ProductsScreen extends StatelessWidget {
return AppBar(
elevation: 0,
centerTitle: false,
title: Text('Dashboard'),
title: Text('CIAT ANDROID'),
actions: <Widget>[
IconButton(
icon: SvgPicture.asset("assets/icons/notification.svg"),
......
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
version: "2.4.2"
boolean_selector:
dependency: transitive
description:
......@@ -29,6 +15,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
charcode:
dependency: transitive
description:
......@@ -36,13 +29,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
version: "1.14.13"
convert:
dependency: transitive
description:
......@@ -56,7 +56,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "2.1.5"
cupertino_icons:
dependency: "direct main"
description:
......@@ -64,25 +64,46 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
version: "5.2.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_datetime_picker:
dependency: "direct main"
description:
name: flutter_datetime_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
flutter_svg:
dependency: "direct main"
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.4"
version: "0.18.1"
flutter_test:
dependency: "direct dev"
description: flutter
......@@ -101,7 +122,7 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.1"
version: "0.12.2"
http_parser:
dependency: transitive
description:
......@@ -109,13 +130,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
image_picker:
dependency: "direct main"
description:
name: image_picker
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.7+6"
image_picker_platform_interface:
dependency: transitive
description:
name: image
name: image_picker_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
version: "1.1.0"
intl:
dependency: transitive
description:
......@@ -129,7 +157,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.6"
version: "0.12.8"
meta:
dependency: transitive
description:
......@@ -137,20 +165,27 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
painter2:
dependency: "direct main"
description:
name: painter2
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
version: "0.4.1+1"
path_parsing:
dependency: transitive
description:
......@@ -164,14 +199,14 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.10"
version: "1.6.14"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+1"
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
......@@ -185,7 +220,7 @@ packages:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
pedantic:
dependency: transitive
description:
......@@ -199,7 +234,7 @@ packages:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
version: "3.0.4"
platform:
dependency: transitive
description:
......@@ -221,13 +256,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.13"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
......@@ -246,7 +274,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.9.5"
stream_channel:
dependency: transitive
description:
......@@ -274,14 +302,21 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.17"
tflite:
dependency: "direct main"
description:
name: tflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.2.0"
vector_math:
dependency: transitive
description:
......@@ -302,7 +337,7 @@ packages:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
version: "4.2.0"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0 <2.0.0"
dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.18.0-6.0.pre <2.0.0"
name: furniture_app
name: DMTI_app
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
......@@ -28,8 +28,12 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
flutter_svg: ^0.17.4 #it helps us to use SVG in our app
flutter_svg: ^0.18.1 #it helps us to use SVG in our app
google_fonts: ^1.1.0 #this allows you to easily use any fonts from fonts.google.com in your Flutter app
tflite: ^1.0.4
image_picker: ^0.6.2+3
flutter_datetime_picker: ^1.4.0
painter2: ^1.0.1
dev_dependencies:
flutter_test:
......@@ -48,8 +52,10 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/
- assets/images/
- assets/icons/
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
......
......@@ -5,11 +5,10 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:DMTI_app/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:furniture_app/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment