dio5 and logs
parent
e514a1cd5c
commit
49115109d5
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
|
|
@ -16,6 +16,9 @@ const Color CHARCOAL = Color(0xFF515151);
|
|||
const Color BLACK_GREY = Color(0xff777777);
|
||||
const Color SOFT_GREY = Color(0xFFaaaaaa);
|
||||
const Color SOFT_BLUE = Color(0xff01aed6);
|
||||
const Color BLACK21 = Color(0xFF212121);
|
||||
const Color BLACK55 = Color(0xFF555555);
|
||||
const Color BLACK77 = Color(0xFF777777);
|
||||
|
||||
const int STATUS_OK = 200;
|
||||
const int STATUS_BAD_REQUEST = 400;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:mobdr/objectbox.g.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
@Entity()
|
||||
class Log {
|
||||
// specify the id
|
||||
@Id()
|
||||
int id = 0;
|
||||
|
||||
String type;
|
||||
DateTime date;
|
||||
String module;
|
||||
String libelle;
|
||||
int duree;
|
||||
int uploaded;
|
||||
|
||||
Log(this.type, this.module, this.libelle, this.duree,
|
||||
{this.id = 0, DateTime? date, this.uploaded = 0})
|
||||
: date = date ?? DateTime.now();
|
||||
|
||||
String get dateFormat => DateFormat('dd.MM.yyyy hh:mm:ss').format(date);
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'objectbox.g.dart';
|
||||
import 'package:mobdr/objectbox.g.dart';
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
|
|
@ -31,6 +31,9 @@ Future<void> main() async {
|
|||
|
||||
objectbox = await ObjectBox.create();
|
||||
|
||||
/// Log
|
||||
objectbox.addLog('LOG', 'MOBDR', 'Ouverture application ', 0);
|
||||
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
|
||||
.then((_) {
|
||||
runApp(MyApp());
|
||||
|
|
|
|||
|
|
@ -20,23 +20,23 @@ class ApiProvider {
|
|||
try {
|
||||
dio.options.headers['content-Type'] = 'application/json';
|
||||
dio.options.headers['Accept'] = 'application/json';
|
||||
dio.options.connectTimeout = 30000; //5s
|
||||
dio.options.receiveTimeout = 25000;
|
||||
dio.options.connectTimeout = Duration(seconds: 5);
|
||||
dio.options.receiveTimeout = Duration(seconds: 4);
|
||||
dio.options.queryParameters = body;
|
||||
|
||||
return await dio.get(url);
|
||||
} on DioError catch (e) {
|
||||
//print(e.toString()+' | '+url.toString());
|
||||
if (e.type == DioErrorType.response) {
|
||||
if (e.type == DioErrorType.badResponse) {
|
||||
int? statusCode = e.response!.statusCode;
|
||||
if (statusCode == STATUS_NOT_FOUND) {
|
||||
throw "Api not found";
|
||||
} else if (statusCode == STATUS_INTERNAL_ERROR) {
|
||||
throw "Internal Server Error";
|
||||
} else {
|
||||
throw e.error.message.toString();
|
||||
throw e.error.toString();
|
||||
}
|
||||
} else if (e.type == DioErrorType.connectTimeout) {
|
||||
} else if (e.type == DioErrorType.connectionTimeout) {
|
||||
throw e.message.toString();
|
||||
} else if (e.type == DioErrorType.cancel) {
|
||||
throw 'cancel';
|
||||
|
|
@ -51,29 +51,29 @@ class ApiProvider {
|
|||
print('url : ' + url.toString());
|
||||
try {
|
||||
dio.options.headers['content-Type'] = 'application/x-www-form-urlencoded';
|
||||
dio.options.connectTimeout = 30000; //5s
|
||||
dio.options.receiveTimeout = 25000;
|
||||
dio.options.connectTimeout = Duration(seconds: 5);
|
||||
dio.options.receiveTimeout = Duration(seconds: 4);
|
||||
|
||||
return await dio.post(url, cancelToken: apiToken);
|
||||
} on DioError catch (e) {
|
||||
//print(e.toString()+' | '+url.toString());
|
||||
if (e.type == DioErrorType.response) {
|
||||
if (e.type == DioErrorType.badResponse) {
|
||||
int? statusCode = e.response!.statusCode;
|
||||
if (statusCode == STATUS_NOT_FOUND) {
|
||||
throw "Api not found";
|
||||
} else if (statusCode == STATUS_INTERNAL_ERROR) {
|
||||
throw "Internal Server Error";
|
||||
} else {
|
||||
throw e.error.message.toString();
|
||||
throw e.error.toString();
|
||||
}
|
||||
} else if (e.type == DioErrorType.connectTimeout) {
|
||||
} else if (e.type == DioErrorType.connectionTimeout) {
|
||||
throw e.message.toString();
|
||||
} else if (e.type == DioErrorType.cancel) {
|
||||
throw 'cancel';
|
||||
}
|
||||
throw connErr;
|
||||
} finally {
|
||||
//dio.close();
|
||||
//dio.close(); // TODO: Attention pas close
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,29 +82,29 @@ class ApiProvider {
|
|||
print('postData : ' + data.toString());
|
||||
try {
|
||||
dio.options.headers['content-Type'] = 'application/x-www-form-urlencoded';
|
||||
dio.options.connectTimeout = 30000; //5s
|
||||
dio.options.receiveTimeout = 25000;
|
||||
dio.options.connectTimeout = Duration(seconds: 5);
|
||||
dio.options.receiveTimeout = Duration(seconds: 4);
|
||||
|
||||
return await dio.post(url, data: data, cancelToken: apiToken);
|
||||
} on DioError catch (e) {
|
||||
//print(e.toString()+' | '+url.toString());
|
||||
if (e.type == DioErrorType.response) {
|
||||
if (e.type == DioErrorType.badResponse) {
|
||||
int? statusCode = e.response!.statusCode;
|
||||
if (statusCode == STATUS_NOT_FOUND) {
|
||||
throw "Api not found";
|
||||
} else if (statusCode == STATUS_INTERNAL_ERROR) {
|
||||
throw "Internal Server Error";
|
||||
} else {
|
||||
throw e.error.message.toString();
|
||||
throw e.error.toString();
|
||||
}
|
||||
} else if (e.type == DioErrorType.connectTimeout) {
|
||||
} else if (e.type == DioErrorType.connectionTimeout) {
|
||||
throw e.message.toString();
|
||||
} else if (e.type == DioErrorType.cancel) {
|
||||
throw 'cancel';
|
||||
}
|
||||
throw connErr;
|
||||
} finally {
|
||||
dio.close();
|
||||
//dio.close(); // TODO: Attention pas close
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -70,9 +70,53 @@
|
|||
}
|
||||
],
|
||||
"relations": []
|
||||
},
|
||||
{
|
||||
"id": "4:4389962693874538546",
|
||||
"lastPropertyId": "7:4949059821139557407",
|
||||
"name": "Log",
|
||||
"properties": [
|
||||
{
|
||||
"id": "1:3034881956612204559",
|
||||
"name": "id",
|
||||
"type": 6,
|
||||
"flags": 1
|
||||
},
|
||||
{
|
||||
"id": "2:1575574682059681804",
|
||||
"name": "type",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "3:8168339759075122864",
|
||||
"name": "date",
|
||||
"type": 10
|
||||
},
|
||||
{
|
||||
"id": "4:1699927074197883718",
|
||||
"name": "module",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "5:7184817111174936621",
|
||||
"name": "libelle",
|
||||
"type": 9
|
||||
},
|
||||
{
|
||||
"id": "6:6213554048326311571",
|
||||
"name": "duree",
|
||||
"type": 6
|
||||
},
|
||||
{
|
||||
"id": "7:4949059821139557407",
|
||||
"name": "uploaded",
|
||||
"type": 6
|
||||
}
|
||||
],
|
||||
"lastEntityId": "3:6664528022814238868",
|
||||
"relations": []
|
||||
}
|
||||
],
|
||||
"lastEntityId": "4:4389962693874538546",
|
||||
"lastIndexId": "0:0",
|
||||
"lastRelationId": "0:0",
|
||||
"lastSequenceId": "0:0",
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'box_user.dart';
|
||||
import 'package:mobdr/db/box_user.dart';
|
||||
import 'package:mobdr/db/box_log.dart';
|
||||
import 'model.dart';
|
||||
import 'objectbox.g.dart'; // created by `flutter pub run build_runner build`
|
||||
|
||||
|
|
@ -15,9 +16,13 @@ class ObjectBox {
|
|||
/// A Box of user.
|
||||
late final Box<User> userBox;
|
||||
|
||||
/// A Box of log.
|
||||
late final Box<Log> logBox;
|
||||
|
||||
ObjectBox._create(this.store) {
|
||||
noteBox = Box<Note>(store);
|
||||
userBox = Box<User>(store);
|
||||
logBox = Box<Log>(store);
|
||||
|
||||
// Add some demo data if the box is empty.
|
||||
if (noteBox.isEmpty()) {
|
||||
|
|
@ -110,4 +115,38 @@ class ObjectBox {
|
|||
// here. To keep it simple, this example just puts a single object.
|
||||
store.box<User>().put(_User);
|
||||
}
|
||||
|
||||
/// LOG ----------------------------------------------------------------------
|
||||
///
|
||||
Future<void> addLog(String type, String module, String libelle, int duree) =>
|
||||
store.runInTransactionAsync(
|
||||
TxMode.write,
|
||||
_addLogInTx,
|
||||
Log(
|
||||
type,
|
||||
module,
|
||||
libelle,
|
||||
duree,
|
||||
));
|
||||
|
||||
static void _addLogInTx(Store store, _Log) {
|
||||
// Perform ObjectBox operations that take longer than a few milliseconds
|
||||
// here. To keep it simple, this example just puts a single object.
|
||||
store.box<Log>().put(_Log);
|
||||
}
|
||||
|
||||
Stream<List<Log>> getLogs() {
|
||||
// Query for all notes, sorted by their date.
|
||||
// https://docs.objectbox.io/queries
|
||||
final builder = logBox.query().order(Log_.date, flags: Order.descending);
|
||||
// Build and watch the query,
|
||||
// set triggerImmediately to emit the query immediately on listen.
|
||||
return builder
|
||||
.watch(triggerImmediately: true)
|
||||
// Map it to a list of notes to be used by a StreamBuilder.
|
||||
.map((query) => query.find());
|
||||
}
|
||||
|
||||
///
|
||||
/// /LOG ---------------------------------------------------------------------
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ import 'package:objectbox/internal.dart'; // generated code can access "internal
|
|||
import 'package:objectbox/objectbox.dart';
|
||||
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';
|
||||
|
||||
import 'box_user.dart';
|
||||
import 'db/box_log.dart';
|
||||
import 'db/box_user.dart';
|
||||
import 'model.dart';
|
||||
|
||||
export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file
|
||||
|
|
@ -87,6 +88,50 @@ final _entities = <ModelEntity>[
|
|||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[]),
|
||||
ModelEntity(
|
||||
id: const IdUid(4, 4389962693874538546),
|
||||
name: 'Log',
|
||||
lastPropertyId: const IdUid(7, 4949059821139557407),
|
||||
flags: 0,
|
||||
properties: <ModelProperty>[
|
||||
ModelProperty(
|
||||
id: const IdUid(1, 3034881956612204559),
|
||||
name: 'id',
|
||||
type: 6,
|
||||
flags: 1),
|
||||
ModelProperty(
|
||||
id: const IdUid(2, 1575574682059681804),
|
||||
name: 'type',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(3, 8168339759075122864),
|
||||
name: 'date',
|
||||
type: 10,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(4, 1699927074197883718),
|
||||
name: 'module',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(5, 7184817111174936621),
|
||||
name: 'libelle',
|
||||
type: 9,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(6, 6213554048326311571),
|
||||
name: 'duree',
|
||||
type: 6,
|
||||
flags: 0),
|
||||
ModelProperty(
|
||||
id: const IdUid(7, 4949059821139557407),
|
||||
name: 'uploaded',
|
||||
type: 6,
|
||||
flags: 0)
|
||||
],
|
||||
relations: <ModelRelation>[],
|
||||
backlinks: <ModelBacklink>[])
|
||||
];
|
||||
|
||||
|
|
@ -110,7 +155,7 @@ Future<Store> openStore(
|
|||
ModelDefinition getObjectBoxModel() {
|
||||
final model = ModelInfo(
|
||||
entities: _entities,
|
||||
lastEntityId: const IdUid(3, 6664528022814238868),
|
||||
lastEntityId: const IdUid(4, 4389962693874538546),
|
||||
lastIndexId: const IdUid(0, 0),
|
||||
lastRelationId: const IdUid(0, 0),
|
||||
lastSequenceId: const IdUid(0, 0),
|
||||
|
|
@ -198,6 +243,49 @@ ModelDefinition getObjectBoxModel() {
|
|||
photo: const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 6, ''));
|
||||
|
||||
return object;
|
||||
}),
|
||||
Log: EntityDefinition<Log>(
|
||||
model: _entities[2],
|
||||
toOneRelations: (Log object) => [],
|
||||
toManyRelations: (Log object) => {},
|
||||
getId: (Log object) => object.id,
|
||||
setId: (Log object, int id) {
|
||||
object.id = id;
|
||||
},
|
||||
objectToFB: (Log object, fb.Builder fbb) {
|
||||
final typeOffset = fbb.writeString(object.type);
|
||||
final moduleOffset = fbb.writeString(object.module);
|
||||
final libelleOffset = fbb.writeString(object.libelle);
|
||||
fbb.startTable(8);
|
||||
fbb.addInt64(0, object.id);
|
||||
fbb.addOffset(1, typeOffset);
|
||||
fbb.addInt64(2, object.date.millisecondsSinceEpoch);
|
||||
fbb.addOffset(3, moduleOffset);
|
||||
fbb.addOffset(4, libelleOffset);
|
||||
fbb.addInt64(5, object.duree);
|
||||
fbb.addInt64(6, object.uploaded);
|
||||
fbb.finish(fbb.endTable());
|
||||
return object.id;
|
||||
},
|
||||
objectFromFB: (Store store, ByteData fbData) {
|
||||
final buffer = fb.BufferContext(fbData);
|
||||
final rootOffset = buffer.derefObject(0);
|
||||
|
||||
final object = Log(
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 6, ''),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 10, ''),
|
||||
const fb.StringReader(asciiOptimization: true)
|
||||
.vTableGet(buffer, rootOffset, 12, ''),
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 14, 0),
|
||||
id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
|
||||
date: DateTime.fromMillisecondsSinceEpoch(
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 8, 0)),
|
||||
uploaded:
|
||||
const fb.Int64Reader().vTableGet(buffer, rootOffset, 16, 0));
|
||||
|
||||
return object;
|
||||
})
|
||||
};
|
||||
|
|
@ -241,3 +329,27 @@ class User_ {
|
|||
static final id_utilisateur =
|
||||
QueryIntegerProperty<User>(_entities[1].properties[5]);
|
||||
}
|
||||
|
||||
/// [Log] entity fields to define ObjectBox queries.
|
||||
class Log_ {
|
||||
/// see [Log.id]
|
||||
static final id = QueryIntegerProperty<Log>(_entities[2].properties[0]);
|
||||
|
||||
/// see [Log.type]
|
||||
static final type = QueryStringProperty<Log>(_entities[2].properties[1]);
|
||||
|
||||
/// see [Log.date]
|
||||
static final date = QueryIntegerProperty<Log>(_entities[2].properties[2]);
|
||||
|
||||
/// see [Log.module]
|
||||
static final module = QueryStringProperty<Log>(_entities[2].properties[3]);
|
||||
|
||||
/// see [Log.libelle]
|
||||
static final libelle = QueryStringProperty<Log>(_entities[2].properties[4]);
|
||||
|
||||
/// see [Log.duree]
|
||||
static final duree = QueryIntegerProperty<Log>(_entities[2].properties[5]);
|
||||
|
||||
/// see [Log.uploaded]
|
||||
static final uploaded = QueryIntegerProperty<Log>(_entities[2].properties[6]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import 'dart:convert';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'package:mobdr/old/login.dart';
|
||||
import 'package:mobdr/old/user_profile.dart';
|
||||
|
||||
class LocalStorage {
|
||||
// static Future<SharedPreferences> get securePref async =>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
import 'package:mobdr/main.dart';
|
||||
import 'package:mobdr/config/global_style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../db/box_log.dart';
|
||||
|
||||
class LogPage extends StatefulWidget {
|
||||
@override
|
||||
_LogPageState createState() => _LogPageState();
|
||||
}
|
||||
|
||||
class _LogPageState extends State<LogPage> {
|
||||
GestureDetector Function(BuildContext, int) _itemBuilder(List<Log> logs) =>
|
||||
(BuildContext context, int index) => GestureDetector(
|
||||
onTap: () => objectbox.noteBox.remove(logs[index].id),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
border:
|
||||
Border(bottom: BorderSide(color: Colors.black12))),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 18.0, horizontal: 10.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
logs[index].libelle,
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
),
|
||||
// Provide a Key for the integration test
|
||||
key: Key('list_log_$index'),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 5.0),
|
||||
child: Text(
|
||||
'Added on ${logs[index].dateFormat}',
|
||||
style: const TextStyle(
|
||||
fontSize: 12.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
iconTheme: IconThemeData(
|
||||
color: GlobalStyle.appBarIconThemeColor,
|
||||
),
|
||||
elevation: GlobalStyle.appBarElevation,
|
||||
title: Text(
|
||||
'Show logs',
|
||||
style: GlobalStyle.appBarTitle,
|
||||
),
|
||||
backgroundColor: GlobalStyle.appBarBackgroundColor,
|
||||
systemOverlayStyle: GlobalStyle.appBarSystemOverlayStyle),
|
||||
body: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: StreamBuilder<List<Log>>(
|
||||
stream: objectbox.getLogs(),
|
||||
builder: (context, snapshot) => ListView.builder(
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
itemCount: snapshot.hasData ? snapshot.data!.length : 0,
|
||||
itemBuilder: _itemBuilder(snapshot.data ?? []))))
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,470 +0,0 @@
|
|||
import 'package:mobdr/config/constant.dart';
|
||||
import 'package:mobdr/config/global_style.dart';
|
||||
import 'package:mobdr/ui/account/payment_method/add_payment_method.dart';
|
||||
import 'package:mobdr/ui/account/payment_method/edit_payment_method.dart';
|
||||
import 'package:mobdr/ui/reusable/reusable_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
|
||||
class PaymentMethodPage extends StatefulWidget {
|
||||
@override
|
||||
_PaymentMethodPageState createState() => _PaymentMethodPageState();
|
||||
}
|
||||
|
||||
class _PaymentMethodPageState extends State<PaymentMethodPage> {
|
||||
// initialize reusable widget
|
||||
final _reusableWidget = ReusableWidget();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
iconTheme: IconThemeData(
|
||||
color: GlobalStyle.appBarIconThemeColor,
|
||||
),
|
||||
elevation: GlobalStyle.appBarElevation,
|
||||
title: Text(
|
||||
'Payment Method',
|
||||
style: GlobalStyle.appBarTitle,
|
||||
),
|
||||
backgroundColor: GlobalStyle.appBarBackgroundColor,
|
||||
systemOverlayStyle: GlobalStyle.appBarSystemOverlayStyle,
|
||||
bottom: _reusableWidget.bottomAppBar(),
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(16),
|
||||
children: [
|
||||
Text('Default Payment Preferences',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: CHARCOAL)),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
padding: EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color(0xffcccccc),
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Text('Payment Method',
|
||||
style:
|
||||
TextStyle(fontSize: 14, color: Colors.grey[400])),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color(0xffcccccc),
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child:
|
||||
Image.asset('assets/images/visa.png', height: 10),
|
||||
),
|
||||
Text('Visa card ending in 4392',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: CHARCOAL))
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24),
|
||||
child: Text('Billing Address',
|
||||
style:
|
||||
TextStyle(fontSize: 14, color: Colors.grey[400])),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tortor tortor, ultrices id scelerisque a, elementum id elit.',
|
||||
style: TextStyle(fontSize: 14, color: CHARCOAL)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24),
|
||||
child: Text('Phone Number',
|
||||
style:
|
||||
TextStyle(fontSize: 14, color: Colors.grey[400])),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
child: Text('0811888999',
|
||||
style: TextStyle(fontSize: 14, color: CHARCOAL)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 32,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 8),
|
||||
child: Text('List of Payment Method',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: CHARCOAL)),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Color(0xffcccccc),
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: DataTable(
|
||||
columns: <DataColumn>[
|
||||
DataColumn(
|
||||
label: Text('Credit Card',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, color: CHARCOAL))),
|
||||
DataColumn(
|
||||
label: Text('Name on Card',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, color: CHARCOAL))),
|
||||
DataColumn(
|
||||
label: Text('Expires on',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, color: CHARCOAL))),
|
||||
DataColumn(
|
||||
label: Text('Action',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, color: CHARCOAL))),
|
||||
],
|
||||
rows: <DataRow>[
|
||||
DataRow(
|
||||
cells: <DataCell>[
|
||||
DataCell(Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color(0xffcccccc),
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: Image.asset('assets/images/visa.png',
|
||||
height: 10),
|
||||
),
|
||||
Text('Visa card ending in 4392')
|
||||
],
|
||||
)),
|
||||
DataCell(Text("Robert Steven")),
|
||||
DataCell(Text("04/2023")),
|
||||
DataCell(Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
padding: EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||
decoration: BoxDecoration(
|
||||
color: SOFT_BLUE,
|
||||
borderRadius: BorderRadius.circular(2)),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Default',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 11)),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Icon(Icons.done,
|
||||
color: Colors.white, size: 11)
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
EditPaymentMethodPage()));
|
||||
},
|
||||
child: Text('Edit',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_showPopupDeletePayment(0);
|
||||
},
|
||||
child: Text('Delete',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
DataRow(
|
||||
cells: <DataCell>[
|
||||
DataCell(Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color(0xffcccccc),
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: Image.asset('assets/images/mastercard.png',
|
||||
height: 20),
|
||||
),
|
||||
Text('MasterCard ending in 5309')
|
||||
],
|
||||
)),
|
||||
DataCell(Text("Robert Steven")),
|
||||
DataCell(Text("07/2022")),
|
||||
DataCell(Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showPopupMakeDefault();
|
||||
},
|
||||
child: Text('Make Default',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
EditPaymentMethodPage()));
|
||||
},
|
||||
child: Text('Edit',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_showPopupDeletePayment(1);
|
||||
},
|
||||
child: Text('Delete',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
DataRow(
|
||||
cells: <DataCell>[
|
||||
DataCell(Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Color(0xffcccccc),
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
child: Image.asset('assets/images/visa.png',
|
||||
height: 10),
|
||||
),
|
||||
Text('Visa card ending in 2285')
|
||||
],
|
||||
)),
|
||||
DataCell(Text("Robert Steven")),
|
||||
DataCell(Text("11/2021")),
|
||||
DataCell(Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 8),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
showPopupMakeDefault();
|
||||
},
|
||||
child: Text('Make Default',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
EditPaymentMethodPage()));
|
||||
},
|
||||
child: Text('Edit',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
_showPopupDeletePayment(2);
|
||||
},
|
||||
child: Text('Delete',
|
||||
style: TextStyle(color: SOFT_BLUE)),
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 32),
|
||||
child: OutlinedButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AddPaymentMethodPage()));
|
||||
},
|
||||
style: ButtonStyle(
|
||||
overlayColor:
|
||||
MaterialStateProperty.all(Colors.transparent),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
)),
|
||||
side: MaterialStateProperty.all(
|
||||
BorderSide(color: SOFT_BLUE, width: 1.0),
|
||||
)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||
child: Text(
|
||||
'Add a card',
|
||||
style: TextStyle(
|
||||
color: SOFT_BLUE,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
)),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
void showPopupMakeDefault() {
|
||||
// set up the buttons
|
||||
Widget cancelButton = TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('No', style: TextStyle(color: SOFT_BLUE)));
|
||||
Widget continueButton = TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
_reusableWidget.startLoading(context, 'Success', 0);
|
||||
},
|
||||
child: Text('Yes', style: TextStyle(color: SOFT_BLUE)));
|
||||
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
title: Text(
|
||||
'Make Default',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
content: Text('Are you sure to make this card as a default payment ?',
|
||||
style: TextStyle(fontSize: 13, color: BLACK_GREY)),
|
||||
actions: [
|
||||
cancelButton,
|
||||
continueButton,
|
||||
],
|
||||
);
|
||||
|
||||
// show the dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showPopupDeletePayment(int index) {
|
||||
// set up the buttons
|
||||
Widget cancelButton = TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('No', style: TextStyle(color: SOFT_BLUE)));
|
||||
Widget continueButton = TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
if (index == 0) {
|
||||
Fluttertoast.showToast(
|
||||
msg:
|
||||
'Please change default payment method if you want to delete this payment method',
|
||||
toastLength: Toast.LENGTH_LONG);
|
||||
} else {
|
||||
_reusableWidget.startLoading(
|
||||
context, 'Delete Payment Method Success', 0);
|
||||
}
|
||||
},
|
||||
child: Text('Yes', style: TextStyle(color: SOFT_BLUE)));
|
||||
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
title: Text(
|
||||
'Delete Payment Method',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
content: Text('Are you sure to delete this payment method ?',
|
||||
style: TextStyle(fontSize: 13, color: BLACK_GREY)),
|
||||
actions: [
|
||||
cancelButton,
|
||||
continueButton,
|
||||
],
|
||||
);
|
||||
|
||||
// show the dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
import 'package:mobdr/config/constant.dart';
|
||||
import 'package:mobdr/config/global_style.dart';
|
||||
import 'package:mobdr/ui/reusable/reusable_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
|
||||
class PrivacyPolicyPage extends StatefulWidget {
|
||||
@override
|
||||
_PrivacyPolicyPageState createState() => _PrivacyPolicyPageState();
|
||||
}
|
||||
|
||||
class _PrivacyPolicyPageState extends State<PrivacyPolicyPage> {
|
||||
// initialize reusable widget
|
||||
final _reusableWidget = ReusableWidget();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
iconTheme: IconThemeData(
|
||||
color: GlobalStyle.appBarIconThemeColor,
|
||||
),
|
||||
elevation: GlobalStyle.appBarElevation,
|
||||
title: Text(
|
||||
'Privacy Policy',
|
||||
style: GlobalStyle.appBarTitle,
|
||||
),
|
||||
backgroundColor: GlobalStyle.appBarBackgroundColor,
|
||||
systemOverlayStyle: GlobalStyle.appBarSystemOverlayStyle,
|
||||
bottom: _reusableWidget.bottomAppBar(),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
|
||||
child: Html(
|
||||
data: """
|
||||
<p><img src="$GLOBAL_URL/apps/ecommerce/account/privacy_policy.png"></p>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tortor tortor, ultrices id scelerisque a, elementum id elit. Maecenas feugiat tellus sed augue malesuada, id tempus ex sodales. Nulla at cursus eros. Integer porttitor ac ipsum quis sollicitudin. Sed mollis sapien massa, et dignissim turpis vulputate et. Ut ac odio porta, blandit velit in, pharetra lacus. Integer aliquam dolor nec augue porttitor hendrerit. Vestibulum aliquam urna finibus, luctus felis nec, hendrerit augue. Fusce eget lacinia leo. Vivamus porttitor, lacus eget rutrum tempus, odio magna tincidunt elit, ut vulputate nibh velit eu lectus. Morbi felis mi, efficitur sed diam in, elementum ullamcorper leo. Ut bibendum lorem consectetur pellentesque gravida. Sed est orci, consectetur id nunc quis, volutpat consectetur nisi.</p>
|
||||
<p>Donec est neque, accumsan sit amet imperdiet porta, suscipit eu ex. Phasellus lobortis mollis pharetra. Donec maximus rhoncus elit, sed pellentesque justo pretium vel. Integer vitae facilisis lectus. Suspendisse potenti. Mauris iaculis placerat feugiat. Integer commodo dui sit amet finibus congue. Nulla egestas lacus vel elit aliquet, at pulvinar ex venenatis. Vivamus eget maximus libero, quis vulputate diam. Pellentesque vel justo vel lectus viverra aliquet ut eget metus.</p>
|
||||
<p>Vivamus malesuada velit pretium laoreet pulvinar. Duis non dignissim sapien, vitae viverra purus. Curabitur a gravida mauris. Nullam turpis odio, ultricies sed ultricies non, sodales eget purus. Donec pulvinar bibendum metus vitae ornare. Phasellus eleifend orci eget blandit sollicitudin. Sed sed urna in magna dignissim eleifend.</p>
|
||||
<p>Vestibulum vitae erat maximus, laoreet ex quis, laoreet nunc. Sed porttitor massa eget cursus rhoncus. Suspendisse et tellus et enim ullamcorper semper eget in nisl. Nam metus mauris, sollicitudin in venenatis at, pretium at nulla. Sed a accumsan dui. Quisque fermentum mollis erat, ac fringilla eros auctor eu. Donec placerat mi ut sem ullamcorper tempor. Pellentesque ut nulla sollicitudin, tempus arcu quis, vulputate dolor. Sed ultrices cursus nisl, nec tempor neque tempus at. Pellentesque nec dolor faucibus, porttitor quam sed, vehicula est. Vestibulum placerat placerat neque eu posuere. Pellentesque id mauris hendrerit, placerat lacus id, auctor eros. Praesent vestibulum mattis est, non facilisis urna accumsan et. Vestibulum scelerisque ornare sapien, nec blandit purus rhoncus mollis. Sed faucibus, augue consequat rhoncus rutrum, sapien mauris dictum quam, nec tempus orci urna vitae lorem. Curabitur sit amet nisl et lacus fringilla pulvinar.</p>
|
||||
<p>Phasellus pellentesque et magna in aliquam. Etiam vehicula dui vitae lectus ultrices iaculis. Nullam volutpat magna vel volutpat laoreet. Donec accumsan mi augue, nec elementum libero imperdiet eget. Duis in enim facilisis, lobortis tellus id, tincidunt urna. Donec ipsum neque, pharetra id imperdiet eget, varius bibendum sapien. Suspendisse tincidunt justo a purus molestie, sed elementum urna scelerisque. Suspendisse eget erat ultrices, suscipit nunc ut, iaculis lacus. Donec finibus, nisi vitae porta sodales, diam sapien scelerisque tortor, vel aliquet urna ex non urna. Etiam dictum eros ut justo ultrices tincidunt. Nulla et neque velit. Phasellus malesuada, lectus et sodales iaculis, sapien nibh ultrices tellus, ut ultrices magna tellus eget tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras non diam ac quam aliquet facilisis sit amet at lectus. Nulla vestibulum libero arcu, eu malesuada ipsum congue feugiat.</p>
|
||||
""",
|
||||
style: {
|
||||
"p": Style.fromTextStyle(
|
||||
TextStyle(fontSize: 16),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -11,10 +11,8 @@ import 'package:mobdr/ui/account/account_information/account_information.dart';
|
|||
import 'package:mobdr/ui/account/last_seen_product.dart';
|
||||
import 'package:mobdr/ui/account/notification_setting.dart';
|
||||
import 'package:mobdr/ui/account/order/order_list.dart';
|
||||
import 'package:mobdr/ui/account/payment_method/payment_method.dart';
|
||||
import 'package:mobdr/ui/account/privacy_policy.dart';
|
||||
import 'package:mobdr/ui/account/log.dart';
|
||||
import 'package:mobdr/ui/account/set_address/set_address.dart';
|
||||
import 'package:mobdr/ui/account/terms_conditions.dart';
|
||||
import 'package:mobdr/ui/general/chat_us.dart';
|
||||
import 'package:mobdr/ui/general/notification.dart';
|
||||
import 'package:mobdr/ui/reusable/reusable_widget.dart';
|
||||
|
|
@ -87,17 +85,13 @@ class _TabAccountPageState extends State<TabAccountPage>
|
|||
_reusableWidget.divider1(),
|
||||
_createListMenu('Order List', OrderListPage()),
|
||||
_reusableWidget.divider1(),
|
||||
_createListMenu('Payment Method', PaymentMethodPage()),
|
||||
_reusableWidget.divider1(),
|
||||
_createListMenu('Last Seen Product', LastSeenProductPage()),
|
||||
_reusableWidget.divider1(),
|
||||
_createListMenu('Notification Setting', NotificationSettingPage()),
|
||||
_reusableWidget.divider1(),
|
||||
_createListMenu('About', AboutPage()),
|
||||
_reusableWidget.divider1(),
|
||||
_createListMenu('Terms and Conditions', TermsConditionsPage()),
|
||||
_reusableWidget.divider1(),
|
||||
_createListMenu('Privacy Policy', PrivacyPolicyPage()),
|
||||
_createListMenu('Show logs', LogPage()),
|
||||
_reusableWidget.divider1(),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(0, 18, 0, 0),
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
import 'package:mobdr/config/constant.dart';
|
||||
import 'package:mobdr/config/global_style.dart';
|
||||
import 'package:mobdr/ui/reusable/reusable_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_html/flutter_html.dart';
|
||||
|
||||
class TermsConditionsPage extends StatefulWidget {
|
||||
@override
|
||||
_TermsConditionsPageState createState() => _TermsConditionsPageState();
|
||||
}
|
||||
|
||||
class _TermsConditionsPageState extends State<TermsConditionsPage> {
|
||||
// initialize reusable widget
|
||||
final _reusableWidget = ReusableWidget();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
iconTheme: IconThemeData(
|
||||
color: GlobalStyle.appBarIconThemeColor,
|
||||
),
|
||||
elevation: GlobalStyle.appBarElevation,
|
||||
title: Text(
|
||||
'Terms and Conditions',
|
||||
style: GlobalStyle.appBarTitle,
|
||||
),
|
||||
backgroundColor: GlobalStyle.appBarBackgroundColor,
|
||||
systemOverlayStyle: GlobalStyle.appBarSystemOverlayStyle,
|
||||
bottom: _reusableWidget.bottomAppBar(),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
|
||||
child: Html(
|
||||
data: """
|
||||
<p><img src="$GLOBAL_URL/apps/ecommerce/account/terms_conditions.png"></p>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tortor tortor, ultrices id scelerisque a, elementum id elit. Maecenas feugiat tellus sed augue malesuada, id tempus ex sodales. Nulla at cursus eros. Integer porttitor ac ipsum quis sollicitudin. Sed mollis sapien massa, et dignissim turpis vulputate et. Ut ac odio porta, blandit velit in, pharetra lacus. Integer aliquam dolor nec augue porttitor hendrerit. Vestibulum aliquam urna finibus, luctus felis nec, hendrerit augue. Fusce eget lacinia leo. Vivamus porttitor, lacus eget rutrum tempus, odio magna tincidunt elit, ut vulputate nibh velit eu lectus. Morbi felis mi, efficitur sed diam in, elementum ullamcorper leo. Ut bibendum lorem consectetur pellentesque gravida. Sed est orci, consectetur id nunc quis, volutpat consectetur nisi.</p>
|
||||
<p>Donec est neque, accumsan sit amet imperdiet porta, suscipit eu ex. Phasellus lobortis mollis pharetra. Donec maximus rhoncus elit, sed pellentesque justo pretium vel. Integer vitae facilisis lectus. Suspendisse potenti. Mauris iaculis placerat feugiat. Integer commodo dui sit amet finibus congue. Nulla egestas lacus vel elit aliquet, at pulvinar ex venenatis. Vivamus eget maximus libero, quis vulputate diam. Pellentesque vel justo vel lectus viverra aliquet ut eget metus.</p>
|
||||
<p>Vivamus malesuada velit pretium laoreet pulvinar. Duis non dignissim sapien, vitae viverra purus. Curabitur a gravida mauris. Nullam turpis odio, ultricies sed ultricies non, sodales eget purus. Donec pulvinar bibendum metus vitae ornare. Phasellus eleifend orci eget blandit sollicitudin. Sed sed urna in magna dignissim eleifend.</p>
|
||||
<p>Vestibulum vitae erat maximus, laoreet ex quis, laoreet nunc. Sed porttitor massa eget cursus rhoncus. Suspendisse et tellus et enim ullamcorper semper eget in nisl. Nam metus mauris, sollicitudin in venenatis at, pretium at nulla. Sed a accumsan dui. Quisque fermentum mollis erat, ac fringilla eros auctor eu. Donec placerat mi ut sem ullamcorper tempor. Pellentesque ut nulla sollicitudin, tempus arcu quis, vulputate dolor. Sed ultrices cursus nisl, nec tempor neque tempus at. Pellentesque nec dolor faucibus, porttitor quam sed, vehicula est. Vestibulum placerat placerat neque eu posuere. Pellentesque id mauris hendrerit, placerat lacus id, auctor eros. Praesent vestibulum mattis est, non facilisis urna accumsan et. Vestibulum scelerisque ornare sapien, nec blandit purus rhoncus mollis. Sed faucibus, augue consequat rhoncus rutrum, sapien mauris dictum quam, nec tempus orci urna vitae lorem. Curabitur sit amet nisl et lacus fringilla pulvinar.</p>
|
||||
<p>Phasellus pellentesque et magna in aliquam. Etiam vehicula dui vitae lectus ultrices iaculis. Nullam volutpat magna vel volutpat laoreet. Donec accumsan mi augue, nec elementum libero imperdiet eget. Duis in enim facilisis, lobortis tellus id, tincidunt urna. Donec ipsum neque, pharetra id imperdiet eget, varius bibendum sapien. Suspendisse tincidunt justo a purus molestie, sed elementum urna scelerisque. Suspendisse eget erat ultrices, suscipit nunc ut, iaculis lacus. Donec finibus, nisi vitae porta sodales, diam sapien scelerisque tortor, vel aliquet urna ex non urna. Etiam dictum eros ut justo ultrices tincidunt. Nulla et neque velit. Phasellus malesuada, lectus et sodales iaculis, sapien nibh ultrices tellus, ut ultrices magna tellus eget tellus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras non diam ac quam aliquet facilisis sit amet at lectus. Nulla vestibulum libero arcu, eu malesuada ipsum congue feugiat.</p>
|
||||
""",
|
||||
style: {
|
||||
"p": Style.fromTextStyle(
|
||||
TextStyle(fontSize: 16),
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,370 @@
|
|||
import 'dart:math';
|
||||
import 'package:mobdr/config/constant.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class GlobalWidget {
|
||||
Random _random = Random();
|
||||
|
||||
// create random color for polylines
|
||||
Color _getColor() {
|
||||
return Color.fromARGB(
|
||||
255, _random.nextInt(255), _random.nextInt(255), _random.nextInt(255));
|
||||
}
|
||||
|
||||
List<IconData> _iconList = [
|
||||
Icons.star_rate,
|
||||
Icons.code,
|
||||
Icons.adb,
|
||||
Icons.android,
|
||||
Icons.select_all,
|
||||
Icons.eco,
|
||||
Icons.label_important,
|
||||
Icons.album,
|
||||
Icons.scatter_plot,
|
||||
Icons.memory,
|
||||
Icons.audiotrack,
|
||||
Icons.miscellaneous_services,
|
||||
Icons.whatshot
|
||||
];
|
||||
|
||||
PreferredSizeWidget globalAppBar() {
|
||||
return AppBar(
|
||||
iconTheme: IconThemeData(
|
||||
color: Colors.black, //change your color here
|
||||
),
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
systemOverlayStyle: SystemUiOverlayStyle.dark,
|
||||
centerTitle: true,
|
||||
title: Image.asset('assets/images/logo_horizontal.png', height: 24),
|
||||
bottom: PreferredSize(
|
||||
child: Container(
|
||||
color: Colors.grey[100],
|
||||
height: 1.0,
|
||||
),
|
||||
preferredSize: Size.fromHeight(1.0)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget screenTabList(
|
||||
{required BuildContext context,
|
||||
required int id,
|
||||
required String title,
|
||||
required IconData icon,
|
||||
String? desc,
|
||||
required StatefulWidget page}) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => page));
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 16, bottom: 16),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(width: 20, child: Text(id.toString())),
|
||||
SizedBox(width: 24),
|
||||
Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
elevation: 2,
|
||||
color: Colors.white,
|
||||
child: Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
child: Icon(icon, color: _getColor()),
|
||||
)),
|
||||
SizedBox(width: 24),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 2),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 14, fontWeight: FontWeight.w400)),
|
||||
SizedBox(height: 4),
|
||||
(desc == null)
|
||||
? Wrap()
|
||||
: Text(desc,
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: Colors.grey[700])),
|
||||
(desc == null) ? Wrap() : SizedBox(height: 4),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget screenDetailList(
|
||||
{required BuildContext context,
|
||||
required String title,
|
||||
required StatefulWidget page}) {
|
||||
Color _color = _getColor();
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => page));
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 8),
|
||||
child: Card(
|
||||
elevation: 0.5,
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(18),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(_iconList[_random.nextInt(_iconList.length)],
|
||||
color: _color, size: 26),
|
||||
SizedBox(width: 24),
|
||||
Expanded(
|
||||
child: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: BLACK55,
|
||||
fontWeight: FontWeight.w500)),
|
||||
),
|
||||
Icon(Icons.chevron_right, size: 30, color: _color),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget createDetailWidget({required String title, required String desc}) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 18, color: BLACK21, fontWeight: FontWeight.w500)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8),
|
||||
child: Container(
|
||||
child: Text(desc,
|
||||
style: TextStyle(
|
||||
fontSize: 15, color: BLACK77, letterSpacing: 0.5)),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24, bottom: 8),
|
||||
child: Text('Example',
|
||||
style: TextStyle(
|
||||
fontSize: 18, color: BLACK21, fontWeight: FontWeight.w500)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget createDetailWidget2(
|
||||
{required String title, required String desc, required IconData icon}) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 18, color: BLACK21, fontWeight: FontWeight.w500)),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24),
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 5,
|
||||
child: Container(
|
||||
child: Text(desc,
|
||||
style: TextStyle(
|
||||
fontSize: 15, color: BLACK77, letterSpacing: 0.5)),
|
||||
)),
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Icon(icon, size: 50, color: SOFT_BLUE)))
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 24, bottom: 16),
|
||||
child: Text('Example',
|
||||
style: TextStyle(
|
||||
fontSize: 18, color: BLACK21, fontWeight: FontWeight.w500)),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget createButton({
|
||||
Color backgroundColor = Colors.blue,
|
||||
Color textColor = Colors.white,
|
||||
required String buttonName,
|
||||
required Function onPressed,
|
||||
}) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith<Color>(
|
||||
(Set<MaterialState> states) => backgroundColor,
|
||||
),
|
||||
overlayColor: MaterialStateProperty.all(Colors.transparent),
|
||||
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(3.0),
|
||||
)),
|
||||
),
|
||||
onPressed: onPressed as void Function(),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
buttonName,
|
||||
style: TextStyle(fontSize: 14, color: textColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget createDefaultLabel(context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.fromLTRB(8, 2, 8, 2),
|
||||
decoration: BoxDecoration(
|
||||
color: SOFT_BLUE, borderRadius: BorderRadius.circular(2)),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Default', style: TextStyle(color: Colors.white, fontSize: 13)),
|
||||
SizedBox(
|
||||
width: 4,
|
||||
),
|
||||
Icon(Icons.done, color: Colors.white, size: 11)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget createRatingBar({double rating = 5, double size = 24}) {
|
||||
if (rating < 0) {
|
||||
rating = 0;
|
||||
} else if (rating > 5) {
|
||||
rating = 5;
|
||||
}
|
||||
|
||||
bool _absolute = false;
|
||||
int _fullStar = 0;
|
||||
int _emptyStar = 0;
|
||||
|
||||
if (rating == 0 ||
|
||||
rating == 1 ||
|
||||
rating == 2 ||
|
||||
rating == 3 ||
|
||||
rating == 4 ||
|
||||
rating == 5) {
|
||||
_absolute = true;
|
||||
} else {
|
||||
double _dec = (rating - int.parse(rating.toString().substring(0, 1)));
|
||||
if (_dec > 0 && _dec < 1) {
|
||||
if (_dec >= 0.25 && _dec <= 0.75) {
|
||||
_absolute = false;
|
||||
} else {
|
||||
_absolute = true;
|
||||
if (_dec < 0.25) {
|
||||
_emptyStar = 1;
|
||||
} else if (_dec > 0.75) {
|
||||
_fullStar = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Row(
|
||||
children: [
|
||||
for (int i = 1; i <= rating + _fullStar; i++)
|
||||
Icon(Icons.star, color: Colors.yellow[700], size: size),
|
||||
!_absolute
|
||||
? Icon(Icons.star_half, color: Colors.yellow[700], size: size)
|
||||
: SizedBox.shrink(),
|
||||
for (int i = 1; i <= (5 - rating + _emptyStar); i++)
|
||||
Icon(Icons.star_border, color: Colors.yellow[700], size: size),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget customNotifIcon(
|
||||
{int count = 0,
|
||||
Color notifColor = Colors.grey,
|
||||
Color labelColor = Colors.pinkAccent,
|
||||
double notifSize = 24,
|
||||
double labelSize = 14,
|
||||
String position = 'right'}) {
|
||||
double? posLeft;
|
||||
double? posRight = 0;
|
||||
if (position == 'left') {
|
||||
posLeft = 0;
|
||||
posRight = null;
|
||||
}
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
Icon(Icons.notifications, color: notifColor, size: notifSize),
|
||||
Positioned(
|
||||
left: posLeft,
|
||||
right: posRight,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(1),
|
||||
decoration: BoxDecoration(
|
||||
color: labelColor,
|
||||
borderRadius: BorderRadius.circular(labelSize),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minWidth: labelSize,
|
||||
minHeight: labelSize,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 8,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildProgressIndicator(lastData) {
|
||||
if (lastData == false) {
|
||||
return new Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: new Center(
|
||||
child: new Opacity(
|
||||
opacity: 1,
|
||||
child: new Container(
|
||||
height: 20,
|
||||
width: 20,
|
||||
margin: EdgeInsets.all(5),
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: new AlwaysStoppedAnimation<Color>(PRIMARY_COLOR),
|
||||
strokeWidth: 2.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -237,10 +237,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8"
|
||||
sha256: "2644a9e0965a7aa3deb09cb8ce4081db4450c178f472818c8cd34216a3070d7b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.6"
|
||||
version: "5.0.2"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -931,5 +931,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.1"
|
||||
sdks:
|
||||
dart: ">=2.19.0 <4.0.0"
|
||||
dart: ">=2.19.0 <3.0.0"
|
||||
flutter: ">=3.3.0"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
version: 0.0.1+1
|
||||
|
||||
environment:
|
||||
sdk: '>=2.19.0 <3.0.0'
|
||||
|
|
@ -31,7 +31,7 @@ dependencies:
|
|||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dio: 4.0.6
|
||||
dio: 5.0.2
|
||||
objectbox: ^1.7.2
|
||||
objectbox_flutter_libs: any
|
||||
pin_code_fields: 7.4.0
|
||||
|
|
@ -43,7 +43,7 @@ dependencies:
|
|||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: 1.0.5
|
||||
fluttertoast: 8.1.3
|
||||
package_info_plus: 3.0.3
|
||||
package_info_plus: ^3.0.3
|
||||
flutter_bloc: 8.1.2
|
||||
flutter_html: 3.0.0-alpha.6
|
||||
|
||||
|
|
@ -123,6 +123,7 @@ flutter:
|
|||
- assets/images/mastercard.png
|
||||
- assets/images/logo.png
|
||||
- assets/images/logo_dark.png
|
||||
- assets/images/logo_horizontal.png
|
||||
- assets/images/onboarding/search_product.gif
|
||||
|
||||
- assets/lang/fr.json
|
||||
|
|
|
|||
Loading…
Reference in New Issue