You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
Dart
81 lines
2.5 KiB
Dart
import 'package:diplomaticquarterapp/config/size_config.dart';
|
|
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/widgets/robo-search/search.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class RoboSearch {
|
|
final BuildContext context;
|
|
var event = RobotProvider();
|
|
var searchText = null;
|
|
RoboSearch({
|
|
@required this.context,
|
|
});
|
|
|
|
showAlertDialog(BuildContext context) {
|
|
// set up the buttons
|
|
|
|
// set up the AlertDialog
|
|
AlertDialog alert = AlertDialog(
|
|
content: StatefulBuilder(
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
setState((){
|
|
event.controller.stream.listen((p) {
|
|
if (p['searchText']!=null) {
|
|
setState(() {
|
|
searchText = p['searchText'];
|
|
});
|
|
}
|
|
});
|
|
});
|
|
return Container(
|
|
color: Colors.white,
|
|
height: SizeConfig.realScreenHeight * 0.5,
|
|
width: SizeConfig.realScreenWidth * 0.8,
|
|
child: Container(
|
|
child: Column(children: [
|
|
Expanded(
|
|
flex: 1,
|
|
child: Center(
|
|
child: Image.asset(
|
|
'assets/images/habib-logo.png',
|
|
height: 75,
|
|
width: 75,
|
|
))),
|
|
Expanded(
|
|
flex: 3,
|
|
child: Center(
|
|
child: Container(
|
|
margin: EdgeInsets.all(20),
|
|
padding: EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
border: Border.all(width: 2, color: Colors.red)),
|
|
child: Icon(
|
|
Icons.mic,
|
|
color: Colors.blue,
|
|
size: 48,
|
|
),
|
|
))),
|
|
Expanded(
|
|
flex: 1, child: Center(child: Text( searchText != null ? searchText : 'Try saying something' )))
|
|
]),
|
|
));
|
|
}),
|
|
);
|
|
|
|
// show the dialog
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return alert;
|
|
},
|
|
);
|
|
}
|
|
|
|
static closeAlertDialog(BuildContext context) {
|
|
Navigator.of(context).pop();
|
|
}
|
|
}
|