Skip to content

Commit

Permalink
[feature] 添加模版
Browse files Browse the repository at this point in the history
  • Loading branch information
lanhuajian committed Nov 29, 2022
1 parent e557a81 commit 7c29b3a
Show file tree
Hide file tree
Showing 37 changed files with 975 additions and 22 deletions.
Binary file added fair_templates/images/appbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fair_templates/images/detail_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fair_templates/images/drawer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fair_templates/images/fab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added fair_templates/images/list_card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fair_templates/images/list_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added fair_templates/images/login_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added fair_templates/images/popupmenubutton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added fair_templates/images/tabbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
208 changes: 208 additions & 0 deletions fair_templates/templates/page/detail_page/fair_detail.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
import 'package:flutter/material.dart';
import 'package:fair/fair.dart';

@FairPatch()
class FairDetail extends StatefulWidget {
final dynamic fairProps;

const FairDetail({Key? key, this.fairProps}) : super(key: key);

@override
State<StatefulWidget> createState() => _FairDetailState();
}

class _FairDetailState extends State<FairDetail> {
@FairProps()
var fairProps;

@override
void initState() {
super.initState();
fairProps = widget.fairProps;
}

/// 顶部widget
Widget _topWidget() {
return Stack(
children: [
Container(
child: Image.network('https://pic3.58cdn.com.cn/nowater/frs/n_v327380fe3313c44cb8528c6a7b5fb501c.jpg'),
),
Positioned(
top: 20,
child: Container(
height: 72,
width: 66,
child: Image.network('https://pic3.58cdn.com.cn/nowater/frs/n_v378fb424b4182441a9f743c44336ea9f5.png'),
),
)
],
);
}

/// 概要widget
Widget _outlineWidget() {
return Padding(
padding: EdgeInsets.fromLTRB(20, 25, 20, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_getAuth(),
style: TextStyle(
color: Color(0xFF3978C4),
fontWeight: FontWeight.w500,
fontSize: 15,
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 15, 0, 0),
child: Text(
_getTitle(),
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
child: Text(
_getDes(),
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.w400,
fontSize: 14,
),
),
),
],
),
);
}

/// 时间&地点
Widget _timeAndLocation() {
return Padding(
padding: EdgeInsets.fromLTRB(20, 15, 20, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
width: 20,
height: 20,
child: Image.network('https://pic7.58cdn.com.cn/nowater/frs/n_v37e6d7991117d417eac9b0214dbc3fb34.png'),
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
_getTime(),
style: TextStyle(
fontSize: 15,
color: Color(0xFF3978C4),
),
maxLines: 1,
),
),
Padding(
padding: EdgeInsets.only(left: 30),
child: Container(
width: 26,
height: 20,
child: Image.network('https://pic5.58cdn.com.cn/nowater/frs/n_v3df9d125924c84b129515973e617aebe1.png'),
),
),
Expanded(
child: Text(
_getLocation(),
style: TextStyle(color: Color(0xFF3978C4)),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
);
}

Widget _DetailTitle() {
return Padding(
padding: EdgeInsets.fromLTRB(20, 25, 20, 0),
child: Text(
'Event Details',
style: TextStyle(
color: Colors.grey, fontSize: 14, fontWeight: FontWeight.w500),
),
);
}

/// 详细信息
Widget _information() {
return Padding(
padding: EdgeInsets.fromLTRB(20, 10, 20, 0),
child: Text(
_getDetailContent(),
style: TextStyle(
color: Color(0xFF121416),
fontSize: 15,
fontWeight: FontWeight.w500),
),
);
}

String _getAuth() {
return fairProps['auth'];
}

String _getTitle() {
return fairProps['title'];
}

String _getDes() {
return fairProps['des'];
}

String _getTime() {
return fairProps['time'];
}

String _getLocation() {
return fairProps['location'];
}

String _getDetailContent() {
return fairProps['detail'];
}

void _onPress(){
print('onPressed');
}

@override
Widget build(BuildContext context) {
return Scaffold(
// floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: Container(
width: Sugar.width(context),
height: 45,
margin: EdgeInsets.fromLTRB(50, 0, 50, 15),
child: ElevatedButton(
onPressed:_onPress,
child: Text('RSVP to Event'),
),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_topWidget(),
_outlineWidget(),
_timeAndLocation(),
_DetailTitle(),
_information(),
],
),
);
}
}
129 changes: 129 additions & 0 deletions fair_templates/templates/page/list_card/list_card_item.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import 'package:fair/fair.dart';
import 'package:flutter/material.dart';

@FairPatch()
class ListCardItem extends StatefulWidget {
const ListCardItem({Key? key}) : super(key: key);

@override
State<ListCardItem> createState() => _ListCardItemState();
}

class _ListCardItemState extends State<ListCardItem> {
@override
Widget build(BuildContext context) {
return Container(
child: Padding(
padding: EdgeInsets.fromLTRB(20, 10, 20, 20),
child: Column(
children: [
Row(
children: [
Expanded(
child: Row(
children: [
CircleAvatar(
radius: 30,
backgroundImage: NetworkImage(
'http://c-ssl.duitang.com/uploads/item/202003/26/20200326223552_nayyt.jpeg'),
),
SizedBox(
width: 20,
),
Text(
'贝贝',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.black),
)
],
)),
Container(
width: 30,
height: 30,
child: Image.network('https://pic6.58cdn.com.cn/nowater/frs/n_v33db8caaa95cc4d1eb9426e9b991bed34.png'),
)
],
),
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
children: [
Expanded(
child: Text(
'换个头像换个心情😊',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.black),
))
],
),
),
Card(
child: Image(
image: NetworkImage(
'https://img2.baidu.com/it/u=4114138728,2649938841&fm=253&fmt=auto&app=138&f=JPEG'),
),
),
Padding(
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
children: [
Expanded(
child: Row(
children: [
SizedBox(
width: 30,
height: 30,
child: Image.network('https://pic7.58cdn.com.cn/nowater/frs/n_v35812c5fc830e49d991d5e17633729392.png'),
),
SizedBox(
width: 15,
),
Text(
'125',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.black54),
),
SizedBox(
width: 30,
),
SizedBox(
width: 30,
height: 30,
child: Image.network('https://pic4.58cdn.com.cn/nowater/frs/n_v3c264a2d3f9864ecabd8f05ee944ccafe.png'),
),
SizedBox(
width: 15,
),
Text(
'66',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.black54),
),
],
)),
SizedBox(
width: 30,
height: 30,
child: Image.network('https://pic7.58cdn.com.cn/nowater/frs/n_v33e401d24fa6f44a1ac7a7d3319eef7e6.png'),
)
],
),
)
],
),
),
);
}
}
Loading

0 comments on commit 7c29b3a

Please sign in to comment.