第一次
This commit is contained in:
parent
4a812d1a16
commit
97c6d06a8f
24
lib/beans/EpgCategoryListBean.dart
Normal file
24
lib/beans/EpgCategoryListBean.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
|
||||
part 'EpgCategoryListBean.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class EpgCategoryListBean {
|
||||
|
||||
String? CategoryName;
|
||||
String? CategoryType;
|
||||
bool? HasMore;
|
||||
int? RowNum;
|
||||
bool? IsQuickStartPopUp;
|
||||
|
||||
|
||||
EpgCategoryListBean(this.CategoryName, this.CategoryType, this.HasMore,
|
||||
this.RowNum, this.IsQuickStartPopUp, );
|
||||
|
||||
factory EpgCategoryListBean.fromJson(Map<String, dynamic> json) => _$EpgCategoryListBeanFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$EpgCategoryListBeanToJson(this);
|
||||
|
||||
}
|
||||
26
lib/beans/EpgCategoryListBean.g.dart
Normal file
26
lib/beans/EpgCategoryListBean.g.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'EpgCategoryListBean.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
EpgCategoryListBean _$EpgCategoryListBeanFromJson(Map<String, dynamic> json) =>
|
||||
EpgCategoryListBean(
|
||||
json['CategoryName'] as String?,
|
||||
json['CategoryType'] as String?,
|
||||
json['HasMore'] as bool?,
|
||||
(json['RowNum'] as num?)?.toInt(),
|
||||
json['IsQuickStartPopUp'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$EpgCategoryListBeanToJson(
|
||||
EpgCategoryListBean instance) =>
|
||||
<String, dynamic>{
|
||||
'CategoryName': instance.CategoryName,
|
||||
'CategoryType': instance.CategoryType,
|
||||
'HasMore': instance.HasMore,
|
||||
'RowNum': instance.RowNum,
|
||||
'IsQuickStartPopUp': instance.IsQuickStartPopUp,
|
||||
};
|
||||
20
lib/beans/HallEpgListBean.dart
Normal file
20
lib/beans/HallEpgListBean.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'EpgCategoryListBean.dart';
|
||||
|
||||
part 'HallEpgListBean.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class HallEpgListBean {
|
||||
|
||||
|
||||
List<EpgCategoryListBean>? EpgCategoryList;
|
||||
|
||||
HallEpgListBean(this.EpgCategoryList);
|
||||
|
||||
|
||||
factory HallEpgListBean.fromJson(Map<String, dynamic> json) => _$HallEpgListBeanFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$HallEpgListBeanToJson(this);
|
||||
|
||||
}
|
||||
20
lib/beans/HallEpgListBean.g.dart
Normal file
20
lib/beans/HallEpgListBean.g.dart
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'HallEpgListBean.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
HallEpgListBean _$HallEpgListBeanFromJson(Map<String, dynamic> json) =>
|
||||
HallEpgListBean(
|
||||
(json['EpgCategoryList'] as List<dynamic>?)
|
||||
?.map((e) => EpgCategoryListBean.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$HallEpgListBeanToJson(HallEpgListBean instance) =>
|
||||
<String, dynamic>{
|
||||
'EpgCategoryList':
|
||||
instance.EpgCategoryList?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
|
|
@ -21,9 +21,7 @@ class Global {
|
|||
}
|
||||
|
||||
static Global _getInstance() {
|
||||
if (_instance == null) {
|
||||
_instance = new Global._internal();
|
||||
}
|
||||
_instance ??= Global._internal();
|
||||
return _instance!;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ Future<void> main() async {
|
|||
await runZonedGuarded(() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
Global.initialize().then((e) {
|
||||
new Global();
|
||||
runApp(ChatApp());
|
||||
Global();
|
||||
runApp(const ChatApp());
|
||||
if (Platform.isAndroid) {
|
||||
// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。
|
||||
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
||||
}
|
||||
});
|
||||
|
|
@ -35,26 +35,21 @@ class ChatApp extends StatefulWidget {
|
|||
|
||||
class _ChatAppState extends State<ChatApp> {
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
print("666666");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'AI聊天',
|
||||
home: Homepage(),
|
||||
|
||||
home: const Homepage(),
|
||||
//注册路由
|
||||
routes: <String, WidgetBuilder>{
|
||||
'/HomePage': (BuildContext context) => Homepage(),
|
||||
'/HomePage': (BuildContext context) => const Homepage(),
|
||||
},
|
||||
|
||||
debugShowMaterialGrid: false,
|
||||
//显示网格
|
||||
debugShowCheckedModeBanner: false,
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ class NetworkConfig {
|
|||
static int SELECT_INDEX = 0;
|
||||
|
||||
static List BASE_URLS = [
|
||||
"http://127.0.0.1:7860/",
|
||||
"http://127.0.0.1:7860/",
|
||||
"http://127.0.0.1:7860/",
|
||||
"http://117.50.182.144:5000/",
|
||||
"http://117.50.182.144:5000/",
|
||||
"http://117.50.182.144:5000/",
|
||||
];
|
||||
|
||||
static List BASE_URLS_AI = [
|
||||
"http://127.0.0.1:7860/",
|
||||
"http://117.50.182.144:5000/",
|
||||
];
|
||||
|
||||
|
||||
|
|
@ -35,4 +35,6 @@ class NetworkConfig {
|
|||
static const String login = "login"; //登录
|
||||
|
||||
|
||||
static const String getHallEpgList = "/api/Epg/GetHallEpgList.ashx"; //获取大厅数据
|
||||
|
||||
}
|
||||
|
|
|
|||
59
lib/tools/HomeModel.dart
Normal file
59
lib/tools/HomeModel.dart
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../beans/HallEpgListBean.dart';
|
||||
import '../common/Global.dart';
|
||||
import '../network/BaseEntity.dart';
|
||||
import '../network/NetworkConfig.dart';
|
||||
import '../network/RequestCenter.dart';
|
||||
|
||||
class HomeModel {
|
||||
StreamController streamController = StreamController.broadcast();
|
||||
|
||||
HomeModel() {
|
||||
setup();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
//初始化
|
||||
}
|
||||
|
||||
//首页大厅数据
|
||||
Future<void> getHallEpgList(int type) async {
|
||||
RequestCenter.instance.request(NetworkConfig.getHallEpgList, {}, (BaseEntity dataEntity) {
|
||||
//print("BaseEntity" + dataEntity.data.toString());
|
||||
if (dataEntity.code == 0 && dataEntity.result == 0) {
|
||||
Map<String, dynamic> json = jsonDecode(dataEntity.data);
|
||||
HallEpgListBean data = HallEpgListBean.fromJson(json);
|
||||
streamController.sink.add({
|
||||
'code': "1", //有数据
|
||||
'data': data,
|
||||
});
|
||||
} else {
|
||||
streamController.sink.add({
|
||||
'code': "-1", //
|
||||
'data': dataEntity.message,
|
||||
});
|
||||
}
|
||||
}, (ErrorEntity errorEntity) {
|
||||
streamController.sink.add({
|
||||
'code': "0", //无数据
|
||||
'data': errorEntity.message,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 获取原生的值
|
||||
invokeNativeMethod(String method, Map<String, Object> map) async {
|
||||
dynamic args;
|
||||
try {
|
||||
args = await Global.method.invokeMethod(method, map);
|
||||
} on PlatformException catch (e) {}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,8 @@ dependencies:
|
|||
cupertino_icons: ^1.0.6
|
||||
flutter_easyloading: ^3.0.5
|
||||
crypto: ^3.0.3
|
||||
shared_preferences: ^2.0.7
|
||||
json_annotation: ^4.9.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
@ -46,6 +48,8 @@ dev_dependencies:
|
|||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^3.0.0
|
||||
build_runner: ^2.4.11
|
||||
json_serializable: ^6.8.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user