Skip to content

Commit

Permalink
remove can launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Notsfsssf committed Feb 28, 2021
1 parent ad7bf1b commit b5c0253
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 59 deletions.
4 changes: 2 additions & 2 deletions lib/component/selectable_html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ class _SelectableHtmlState extends State<SelectableHtml> {
return null;
},
onTapUrl: (String url) async {
if (await canLaunch(url)) {
try {
await launch(url);
} else {
} catch (e) {
Share.share(url);
}
},
Expand Down
5 changes: 3 additions & 2 deletions lib/page/about/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class _AboutPageState extends State<AboutPage> {

bool hasNewVersion;
IAPStore iapStore;

@override
void initState() {
iapStore = IAPStore();
Expand Down Expand Up @@ -313,9 +314,9 @@ class _AboutPageState extends State<AboutPage> {
onTap: () async {
if (Platform.isIOS) {
var url = 'https://apps.apple.com/cn/app/pixez/id1494435126';
if (await canLaunch(url)) {
try {
await launch(url);
} else {}
} catch (e) {}
}
},
),
Expand Down
96 changes: 47 additions & 49 deletions lib/page/create/user/create_user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,31 @@ class _CreateUserPageState extends State<CreateUserPage> {
body: Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Builder(
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
TextFormField(
maxLines: 1,
decoration: InputDecoration(
icon: Icon(Icons.supervised_user_circle),
hintText: I18n.of(context).nickname,
labelText: '${I18n.of(context).nickname} *',
),
controller: _userNameController,
child: Builder(builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
TextFormField(
maxLines: 1,
decoration: InputDecoration(
icon: Icon(Icons.supervised_user_circle),
hintText: I18n.of(context).nickname,
labelText: '${I18n.of(context).nickname} *',
),
RaisedButton(
onPressed: () async {
try {
final name = _userNameController.text.trim();
if (name == null || name.isEmpty) return;
final response =
await AccountClient().createProvisionalAccount(name);
print(response.data);
var createUserResponseFromJson2 =
CreateUserResponse.fromJson(response.data);
Navigator.of(context).pop(createUserResponseFromJson2);
controller: _userNameController,
),
RaisedButton(
onPressed: () async {
try {
final name = _userNameController.text.trim();
if (name == null || name.isEmpty) return;
final response =
await AccountClient().createProvisionalAccount(name);
print(response.data);
var createUserResponseFromJson2 =
CreateUserResponse.fromJson(response.data);
Navigator.of(context).pop(createUserResponseFromJson2);
/* AccountProvider accountProvider = new AccountProvider();
await accountProvider.open();
var accountResponse = createUserResponseFromJson2.body;
Expand All @@ -92,31 +91,30 @@ class _CreateUserPageState extends State<CreateUserPage> {
..mailAddress = user.mailAddress
..account = user.account
..xRestrict = user.xRestrict);*/
} catch (e) {
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text("创建次数过多")));
}
},
child: Text("Start"),
} catch (e) {
Scaffold.of(context)
.showSnackBar(SnackBar(content: Text("创建次数过多")));
}
},
child: Text("Start"),
),
Center(
child: Text(I18n.of(context).nickname_can_be_change_anytime),
),
FlatButton(
child: Text(
I18n.of(context).terms,
),
Center(
child: Text(I18n.of(context).nickname_can_be_change_anytime),
),
FlatButton(
child: Text(
I18n.of(context).terms,
),
onPressed: () async {
final url = 'https://www.pixiv.net/terms/?page=term';
if (await canLaunch(url)) {
await launch(url);
} else {}
},
),
],
);
}
),
onPressed: () async {
final url = 'https://www.pixiv.net/terms/?page=term';
try {
await launch(url);
} catch (e) {}
},
),
],
);
}),
),
),
);
Expand Down
4 changes: 2 additions & 2 deletions lib/page/login/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ class _LoginPageState extends State<LoginPage> {
onPressed: () async {
final url =
'https://www.pixiv.net/terms/?page=term';
if (await canLaunch(url)) {
try {
await launch(url);
} else {}
} catch (e) {}
},
),
],
Expand Down
8 changes: 4 additions & 4 deletions lib/page/user/detail/user_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ class _UserDetailPageState extends State<UserDetailPage> {
DataCell(Text(profile.twitter_account),
onTap: () async {
final url = profile.twitter_url;
if (await canLaunch(url)) {
try {
await launch(url);
} else {}
} catch (e) {}
}),
]),
DataRow(cells: [
Expand All @@ -124,9 +124,9 @@ class _UserDetailPageState extends State<UserDetailPage> {
onTap: () async {
if (!public.pawoo) return;
var url = detail.profile.pawoo_url;
if (await canLaunch(url)) {
try {
await launch(url);
} else {}
} catch (e) {}
}),
]),
],
Expand Down

0 comments on commit b5c0253

Please sign in to comment.