v1.0.23
This commit is contained in:
+13
-15
@@ -1,9 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:workouttest_util/model/cache.dart';
|
||||
import 'package:workouttest_util/service/customer_service.dart';
|
||||
import 'package:workouttest_util/service/openai_service.dart';
|
||||
|
||||
void main() {
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await dotenv.load(fileName: ".env");
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -14,31 +17,30 @@ class MyApp extends StatefulWidget {
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
String _response = "";
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _fetchData() async {
|
||||
var api = OpenAIApi();
|
||||
String response = await api.getOpenAICompletion("Who wrote the song 'yellow submarine'?");
|
||||
//var api = OpenAIApi();
|
||||
//String response = await api.getOpenAICompletion("Who wrote the song 'yellow submarine'?");
|
||||
await CustomerApi().getCustomer(72);
|
||||
String response = "OK";
|
||||
setState(() {
|
||||
_response = response;
|
||||
_response = response;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Cache().setLocalBaseUrl();
|
||||
|
||||
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("Example"),
|
||||
),
|
||||
@@ -57,16 +59,12 @@ class _MyAppState extends State<MyApp> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
FloatingActionButton(
|
||||
onPressed:() => {
|
||||
_fetchData()
|
||||
},
|
||||
onPressed: () => {_fetchData()},
|
||||
tooltip: 'Send question',
|
||||
child: const Icon(Icons.ad_units),
|
||||
),
|
||||
|
||||
],
|
||||
)
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user