Browse Source

更新以来了

boyrobot 9 months ago
parent
commit
d3df5c0d6a

+ 0 - 1
lib/bizmodule/main/category/blocs/category_bloc.dart

@@ -11,7 +11,6 @@ class CategoryBloc extends Bloc<CategoryEvent, CategoryState> {
     add(EventRequestCategory()); //初始状态,手动添加首次请求事件
   }
 
-  @override
   Stream<CategoryState> mapEventToState(CategoryEvent event) async* {
     if (event is EventRequestCategory) {
       yield StateLoading();

+ 0 - 1
lib/bizmodule/main/community/widget/ugc_item.dart

@@ -1,7 +1,6 @@
 import 'package:eye_video/bizmodule/bizwidget/follow_list_head.dart';
 import 'package:eye_video/bizmodule/main/community/extension/ext_community.dart';
 import 'package:eye_video/bizmodule/main/community/model/community_model.dart';
-import 'package:eye_video/framework/extension/screen_ruler.dart';
 import 'package:eye_video/framework/uikit/layout/nine_layout.dart';
 import 'package:flutter/material.dart';
 import 'package:eye_video/framework/extension/image_compress.dart';

+ 27 - 18
lib/framework/network/cookie/pretty_cookie.dart

@@ -1,5 +1,3 @@
-import 'dart:io';
-
 import 'package:cookie_jar/cookie_jar.dart';
 
 class CookieJarImpl implements CookieJar {
@@ -7,35 +5,46 @@ class CookieJarImpl implements CookieJar {
   static const String _COOKIE_KEY_SDK = 'sdk';
   static const String _COOKIE_AUTH_SAVE_KEY = 'KeyAuthCookie';
 
+  void saveCookieValue(String value) {
+    //save cookie into sp
+  }
+
+  String getCookieValue() {
+    //get cookie from sp
+    return "";
+  }
+
+  @override
+  bool get ignoreExpires => false;
+
+  @override
+  Future<void> delete(Uri uri, [bool withDomainSharedCookie = false]) {
+    // TODO: implement delete
+    throw UnimplementedError();
+  }
+
   @override
-  List<Cookie> loadForRequest(Uri uri) {
+  Future<void> deleteAll() {
+    // TODO: implement deleteAll
+    throw UnimplementedError();
+  }
+
+  @override
+  Future<List<Cookie>> loadForRequest(Uri uri) {
     List<Cookie> cookies = [];
     var cookie1 = Cookie(_COOKIE_KEY_SDK, '28')..domain = uri.host;
     cookies.add(cookie1);
     var cookie2 = Cookie(_COOKIE_KEY_AUTH, getCookieValue())..domain = uri.host;
     cookies.add(cookie2);
-    return cookies;
+    return Future.value(cookies);
   }
 
   @override
-  void saveFromResponse(Uri uri, List<Cookie> cookies) {
+  Future<void> saveFromResponse(Uri uri, List<Cookie> cookies) {
     Cookie cookieValue =
         cookies.singleWhere((element) => element.name == _COOKIE_KEY_AUTH);
     if (cookieValue != null) {
       saveCookieValue(cookieValue.value);
     }
   }
-
-  void saveCookieValue(String value) {
-    //save cookie into sp
-
-  }
-
-  String getCookieValue() {
-    //get cookie from sp
-    return "";
-  }
-
-  @override
-  bool get ignoreExpires => false;
 }

+ 3 - 3
lib/framework/network/dio_client.dart

@@ -46,9 +46,9 @@ class DioHttpClient {
   static BaseOptions createOptions(String baseUrl,
       {Map<String, dynamic> headers, Map<String, dynamic> queryParameters}) {
     return BaseOptions(
-      connectTimeout: _DEFAULT_CONNECT_TIMEOUT,
-      sendTimeout: _DEFAULT_SEND_TIMEOUT,
-      receiveTimeout: _DEFAULT_RECEIVE_TIMEOUT,
+      connectTimeout: Duration(milliseconds: _DEFAULT_CONNECT_TIMEOUT),
+      sendTimeout: Duration(milliseconds: _DEFAULT_SEND_TIMEOUT),
+      receiveTimeout: Duration(milliseconds: _DEFAULT_RECEIVE_TIMEOUT),
       baseUrl: baseUrl,
       responseType: ResponseType.json,
       validateStatus: (status) {

+ 51 - 51
lib/framework/network/interceptor/log_interceptor.dart

@@ -28,56 +28,12 @@ class PrettyLogInterceptor extends Interceptor {
   /// Print error message
   bool error;
 
-
-  @override
-  Future onRequest(RequestOptions options) async {
-    _printRequest(options);
-  }
-
-  @override
-  Future onError(DioError err) async {
-    if (error) {
-      print('*** DioError ***:');
-      print('uri: ${err.request.uri}');
-      print('$err');
-      if (err.response != null) {
-        _printResponse(err.response);
-      }
-      print('');
-    }
-  }
-
-  void _printRequest(RequestOptions options) async {
-    print('*** Request ***');
-    _printKV('uri', options.uri);
-
-    if (request) {
-      _printKV('method', options.method);
-      _printKV('responseType', options.responseType?.toString());
-      _printKV('followRedirects', options.followRedirects);
-      _printKV('connectTimeout', options.connectTimeout);
-      _printKV('receiveTimeout', options.receiveTimeout);
-      _printKV('extra', options.extra);
-    }
-    if (requestHeader) {
-      print('headers:');
-      options.headers.forEach((key, v) => _printKV(' $key', v));
-    }
-    if (requestBody) {
-      print('data:');
-      _printAll(options.data);
-    }
-    print('');
-  }
-
-  @override
-  Future onResponse(Response response) async {
-    print('*** Response ***');
-    _printResponse(response);
+  void _printKV(String key, Object v) {
+    print('$key: $v');
   }
 
   void _printResponse(Response response) {
-    _printKV('uri', response.request?.uri);
+    _printKV('uri', response.requestOptions.uri);
     if (responseHeader) {
       _printKV('statusCode', response.statusCode);
       if (response.isRedirect == true) {
@@ -95,11 +51,55 @@ class PrettyLogInterceptor extends Interceptor {
     print('');
   }
 
-  void _printKV(String key, Object v) {
-    print('$key: $v');
-  }
-
   void _printAll(msg) {
     msg.toString().split('\n').forEach(print);
   }
+
+  @override
+  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
+    super.onRequest(options, handler);
+  }
+
+  @override
+  void onError(DioException err, ErrorInterceptorHandler handler) {
+    super.onError(err, handler);
+    if (error) {
+      print('*** DioError ***:');
+      print('uri: ${err.requestOptions.uri}');
+      print('$err');
+      if (err.response != null) {
+        _printResponse(err.response);
+      }
+      print('');
+    }
+
+    void _printRequest(RequestOptions options) async {
+      print('*** Request ***');
+      _printKV('uri', options.uri);
+
+      if (request) {
+        _printKV('method', options.method);
+        _printKV('responseType', options.responseType?.toString());
+        _printKV('followRedirects', options.followRedirects);
+        _printKV('connectTimeout', options.connectTimeout);
+        _printKV('receiveTimeout', options.receiveTimeout);
+        _printKV('extra', options.extra);
+      }
+      if (requestHeader) {
+        print('headers:');
+        options.headers.forEach((key, v) => _printKV(' $key', v));
+      }
+      if (requestBody) {
+        print('data:');
+        _printAll(options.data);
+      }
+      print('');
+    }
+
+    @override
+    Future onResponse(Response response) async {
+      print('*** Response ***');
+      _printResponse(response);
+    }
+  }
 }

+ 4 - 4
lib/framework/uikit/refresher/indicator/classic/classic_footer.dart

@@ -61,11 +61,11 @@ class ClassicFooter extends Footer {
     this.loadedText,
     this.loadFailedText,
     this.noMoreText,
-    this.showInfo: true,
+    this.showInfo = true,
     this.infoText,
-    this.bgColor: Colors.transparent,
-    this.textColor: Colors.black,
-    this.infoColor: Colors.teal,
+    this.bgColor = Colors.transparent,
+    this.textColor = Colors.black,
+    this.infoColor = Colors.teal,
   }) : super(
           extent: extent,
           triggerDistance: triggerDistance,

+ 4 - 4
lib/framework/uikit/refresher/indicator/classic/classic_header.dart

@@ -61,11 +61,11 @@ class ClassicHeader extends Header {
     this.refreshedText,
     this.refreshFailedText,
     this.noMoreText,
-    this.showInfo: true,
+    this.showInfo = true,
     this.infoText,
-    this.bgColor: Colors.transparent,
-    this.textColor: Colors.black,
-    this.infoColor: Colors.teal,
+    this.bgColor = Colors.transparent,
+    this.textColor = Colors.black,
+    this.infoColor = Colors.teal,
   }) : super(
           extent: extent,
           triggerDistance: triggerDistance,

+ 10 - 10
pubspec.yaml

@@ -1,7 +1,7 @@
 name: eye_video
 description: A new Flutter project.
 publish_to: 'none' # Remove this line if you wish to publish to pub.dev
-version: 1.2.1+1
+version: 1.2.5+1
 
 environment:
   sdk: '>=2.7.0 <3.0.0'
@@ -11,20 +11,20 @@ dependencies:
     sdk: flutter
 
   cupertino_icons: ^1.0.5
-  flutter_bloc: ^5.0.1
-  dio: ^3.0.0
-  cookie_jar: ^1.0.1
-  dio_cookie_manager: ^1.0.0
-  json_annotation: ^3.0.1
-  equatable: ^1.2.1
+  flutter_bloc: ^8.1.3
+  dio: ^5.3.0
+  cookie_jar: ^4.0.8
+  dio_cookie_manager: ^3.1.0
+  json_annotation: ^4.8.1
+  equatable: ^2.0.5
   flutter_easyrefresh: ^2.1.1 # 下拉刷新
-  dwds: ^5.0.0
+  dwds: ^16.0.3
 
 dev_dependencies:
   flutter_test:
     sdk: flutter
-  json_serializable: ^3.3.0
-  build_runner: ^1.10.0
+  json_serializable: ^6.6.2
+  build_runner: ^2.3.3
 
 flutter:
   uses-material-design: true