Skip to content

Instantly share code, notes, and snippets.

View main.dart
//fungsi untuk return image list carousel
List<Widget> listImage(List list){
var obj = list.map((url){
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
child: InkWell(
onTap: (){
View ShowImageFullSlider.dart
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SliderShowFullmages extends StatefulWidget{
final List listImagesModel;
final int current;
const SliderShowFullmages({ Key key, this.listImagesModel, this.current }) : super(key: key);
@override
_SliderShowFullmagesState createState() => _SliderShowFullmagesState();
}
View chatbotMainFloatingButton.dart
floatingActionButton: FloatingActionButton(
child: new IconButton(icon: new Image.asset("assets/chatbot.jpg"),
tooltip: "Chat Me",
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => ChatbotDialogflow()));
},
),
onPressed: (){},
backgroundColor: Colors.white,
),
View chatbotResponse.dart
void response(query) async {
_textController.clear();
df.AuthGoogle authGoogle =
await df.AuthGoogle(fileJson: 'assets/credential-dialogflow.json').build();
df.Dialogflow dialogflow =
df.Dialogflow(authGoogle: authGoogle, sessionId: '123456');
df.DetectIntentResponse response = await dialogflow.detectIntentFromText(query, "id");
ChatMessage message = new ChatMessage(
text: response.queryResult.fulfillmentText,
name: 'Munaroh',
View chatbot.dart
import 'package:flutter_dialogflow_v2/flutter_dialogflow_v2.dart' as df;
import 'package:flutter/material.dart';
class ChatbotDialogflow extends StatefulWidget {
ChatbotDialogflow({Key key, this.title}) : super(key: key);
final String title;
@override
_ChatbotDialogflowState createState() => new _ChatbotDialogflowState();
}
class _ChatbotDialogflowState extends State<ChatbotDialogflow> {
final List<ChatMessage> _messages = <ChatMessage>[];
View DbLite.dart
import 'dart:async';
import 'dart:io' as io;
import 'package:belajar_flutter_karywan_app/Model/KaryawanModel.dart';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path_provider/path_provider.dart';
class DbLite{
static final DbLite _instance = new DbLite.internal();
View DbLiteHapus.dart
Future<int> deleteKaryawan(id) async{
var dbClient = await db;
int res = await dbClient.delete("Karyawan", where: "id = ?", whereArgs: [id]);
return res;
}
View KaryawanDelete.dart
//fungsi save
void _deleteKaryawan(KaryawanModel model){
final db = new DbLite();
PopupHelper().alertDialogCuprtino(context, "Mohon tunggu...");
Future.delayed( Duration(seconds: 3), (){
db.deleteKaryawan(model.id).then((value){ //hapus data yg ada di database
if(value > 0){
setState(() {
modelList.remove(model); //hapus data yg ada di list
});
View KaryawanReportWidget.dart
Column(
children: [
Padding(
padding: EdgeInsets.all(5),
child: Padding(
padding: EdgeInsets.only(top: 20, left: 20, bottom: 20),
child: Row(
children: [
Icon(Icons.view_list, color: Colors.grey),
Padding(
View KaryawanReport.dart
import 'package:belajar_flutter_karywan_app/MainMenu.dart';
import 'package:belajar_flutter_karywan_app/Model/KaryawanModel.dart';
import 'package:belajar_flutter_karywan_app/Repository/DbLite.dart';
import 'package:belajar_flutter_karywan_app/WidgetHelper/PopupHelper.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
class KaryawanReport extends StatefulWidget {