From d42c5e085f92b9ab46eceea1df5bf1404ca2db6f Mon Sep 17 00:00:00 2001 From: ryan730 Date: Sat, 12 Jan 2019 18:12:47 +0800 Subject: [PATCH] =?UTF-8?q?Modify:=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E7=9A=84=E5=A4=A7=E5=B0=8F=E5=86=99=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/components/Pagination.dart | 63 ---------------------------------- lib/components/pagination.dart | 2 +- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 lib/components/Pagination.dart diff --git a/lib/components/Pagination.dart b/lib/components/Pagination.dart deleted file mode 100644 index 61b3b5d4..00000000 --- a/lib/components/Pagination.dart +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import './homeBanner.dart'; -import '../model/story.dart'; -import 'package:url_launcher/url_launcher.dart'; - -class Pagination extends StatelessWidget { - static final String routeName = '/material/page-selector'; - static final List icons = [ - const Icon(Icons.event, semanticLabel: 'Event'), - const Icon(Icons.home, semanticLabel: 'Home'), - const Icon(Icons.android, semanticLabel: 'Android'), - const Icon(Icons.alarm, semanticLabel: 'Alarm'), - const Icon(Icons.face, semanticLabel: 'Face'), - const Icon(Icons.language, semanticLabel: 'Language'), - ]; - - final List bannerStories = []; - - final List arr = [ - {'image': 'https://img.alicdn.com/tfs/TB1W4hMAwHqK1RjSZJnXXbNLpXa-519-260.jpg', 'type': 0, 'id': 9695909, 'url': 'https://www.zhihu.com/question/294145797/answer/551162834', 'title': '为什么阿里巴巴、腾讯和 Google 之类的企业都在使用 Flutter 开发 App?'}, - {'image': 'https://img.alicdn.com/tfs/TB1XmFIApzqK1RjSZSgXXcpAVXa-720-338.jpg', 'type': 0, 'id': 9695859, 'url': 'https://zhuanlan.zhihu.com/p/51696594', 'title': 'Flutter 1.0 正式发布: Google 的便携 UI 工具包'}, - {'image': 'https://img.alicdn.com/tfs/TB1mClCABLoK1RjSZFuXXXn0XXa-600-362.jpg', 'type': 0, 'id': 96956491409, 'url':'https://zhuanlan.zhihu.com/p/53497167','title': 'Flutter 示范应用现已开源 — 万物起源(The History of Everything)'}, - {'image': 'https://img.alicdn.com/tfs/TB1fXxIAAvoK1RjSZFNXXcxMVXa-600-362.jpg', 'type': 0, 'id': 9695816, 'url': 'https://mp.weixin.qq.com/s?__biz=MzAwODY4OTk2Mg==&mid=2652048101&idx=1&sn=20296088e4bd8ca33c5c9991167d9f7d&chksm=808caaa0b7fb23b65c0e5806209f8d86da6732f3a00a70353f3606018339518b0a8656f14dc5&mpshare=1&scene=2&srcid=0106SZapVysZdIS6Oc5AhNH6&from=timeline&ascene=2&devicetype=android-27&version=27000038&nettype=WIFI&abtest_cookie=BQABAAgACgALABMAFAAFAJ2GHgAjlx4AV5keAJuZHgCcmR4AAAA%3D&lang=zh_CN&pass_ticket=4K1%2FUpsxP4suPj2iubR17wbAP7r9LW9iYrPAC2dppTqv7j7JO5FWMXtcKeBRxueV&wx_header=1', 'title': 'Flutter 与 Material Design 双剑合璧,助您构建精美应用'} - ]; - - void _launchURL(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } - } - - List _pageSelector(BuildContext context) { - List list = []; - /// super.initState(); - arr.forEach((item) { - bannerStories.add(StoryModel.fromJson(item)); - }); - - - if (arr.length > 0) { - list.add(HomeBanner(bannerStories, (story) { - _launchURL('${story.url}'); - })); - } - return list; - } - - @override - Widget build(BuildContext context) { - return - Column( - //physics: AlwaysScrollableScrollPhysics(), - //padding: EdgeInsets.only(), - children: _pageSelector(context) - ); - } -} diff --git a/lib/components/pagination.dart b/lib/components/pagination.dart index 61b3b5d4..2793882d 100644 --- a/lib/components/pagination.dart +++ b/lib/components/pagination.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. import 'package:flutter/material.dart'; -import './homeBanner.dart'; +import './home_banner.dart'; import '../model/story.dart'; import 'package:url_launcher/url_launcher.dart';