Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

update for new textTheme #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
romreed wants to merge 1 commit into flutterplugin:dependabot/pub/dio-5.0.3
base: dependabot/pub/dio-5.0.3
Choose a base branch
Loading
from romreed:dependabot/pub/dio-5.0.3
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dart_tool/version
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.22.1
61 changes: 61 additions & 0 deletions .history/example/lib/home_page_20240919135301.dart
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:dio_log/dio_log.dart';
import 'package:flutter/material.dart';

import 'http_utils.dart';

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
TextEditingController controller = TextEditingController();

String url = 'https://api.github.com/users';

@override
void initState() {
super.initState();
showDebugBtn(context, btnColor: Colors.blue);
controller.text = url;
}

@override
void dispose() {
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'enter the requesr you want to send and press the send button',
),
TextField(
controller: controller,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _sendRequest,
child: Icon(Icons.send),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}

_sendRequest() async {
httpGet(controller.text);
}
}
61 changes: 61 additions & 0 deletions .history/example/lib/home_page_20240919135427.dart
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:dio_log/dio_log.dart';
import 'package:flutter/material.dart';

import 'http_utils.dart';

class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);

final String title;

@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
TextEditingController controller = TextEditingController();

String url = 'https://api.github.com/users';

@override
void initState() {
super.initState();
showDebugBtn(context, btnColor: Colors.blue);
controller.text = url;
}

@override
void dispose() {
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'enter the requesr you want to send and press the send button',
),
TextField(
controller: controller,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _sendRequest,
child: Icon(Icons.send),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}

_sendRequest() async {
httpGet(controller.text);
}
}
138 changes: 138 additions & 0 deletions .history/lib/http_log_list_widget_20240919135301.dart
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import 'dart:collection';

import 'package:flutter/material.dart';

import 'bean/net_options.dart';
import 'dio_log.dart';
import 'page/log_widget.dart';

///网络请求日志列表
class HttpLogListWidget extends StatefulWidget {
@override
_HttpLogListWidgetState createState() => _HttpLogListWidgetState();
}

class _HttpLogListWidgetState extends State<HttpLogListWidget> {
LinkedHashMap<String, NetOptions>? logMap;
List<String>? keys;

@override
Widget build(BuildContext context) {
logMap = LogPoolManager.getInstance().logMap;
keys = LogPoolManager.getInstance().keys;
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
title: Text(
'Request Logs',
),
backgroundColor: theme.scaffoldBackgroundColor,
elevation: 1.0,
iconTheme: theme.iconTheme,
actions: <Widget>[
InkWell(
onTap: () {
if (debugBtnIsShow()) {
dismissDebugBtn();
} else {
showDebugBtn(context);
}
setState(() {});
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Align(
child: Text(
debugBtnIsShow() ? 'close overlay' : 'open overlay',
style: theme.textTheme.caption!
.copyWith(fontWeight: FontWeight.bold),
),
),
),
),
InkWell(
onTap: () {
LogPoolManager.getInstance().clear();
setState(() {});
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Align(
child: Text(
'clear',
style: theme.textTheme.caption!
.copyWith(fontWeight: FontWeight.bold),
),
),
),
),
],
),
body: logMap!.length < 1
? Center(
child: Text('no request log'),
)
: ListView.builder(
reverse: false,
itemCount: keys!.length,
itemBuilder: (BuildContext context, int index) {
NetOptions item = logMap![keys![index]]!;
return _buildItem(item);
},
),
);
}

///构建请求的简易信息
Widget _buildItem(NetOptions item) {
var resOpt = item.resOptions;
var reqOpt = item.reqOptions!;

///格式化请求时间
var requestTime = getTimeStr1(reqOpt.requestTime!);

Color? textColor = LogPoolManager.getInstance().isError(item)
? Colors.red
: Theme.of(context).textTheme.bodyText1!.color;
return Card(
margin: EdgeInsets.all(8),
elevation: 6,
child: InkWell(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return LogWidget(item);
}));
},
child: Container(
width: double.infinity,
padding: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'url: ${reqOpt.url}',
style: TextStyle(
color: textColor,
),
),
Divider(height: 2),
Text(
'status: ${resOpt?.statusCode}',
style: TextStyle(
color: textColor,
),
),
Divider(height: 2),
Text(
'requestTime: $requestTime duration: ${resOpt?.duration ?? 0}ms',
style: TextStyle(
color: textColor,
),
),
],
),
),
),
);
}
}
Loading

AltStyle によって変換されたページ (->オリジナル) /