Skip to content

Commit

Permalink
- ボタンのデザインの変更
Browse files Browse the repository at this point in the history
  • Loading branch information
higedamc committed Nov 22, 2021
1 parent 459dad3 commit f3fe13d
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 60 deletions.
123 changes: 89 additions & 34 deletions lib/pages/custom_dialog_box.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:kiatsu/const/constants.dart';

class CustomDialogBox extends StatefulWidget {
final String title, descriptions, text;

const CustomDialogBox({required Key key, required this.title, required this.descriptions, required this.text}) : super(key: key);
const CustomDialogBox(
{required Key key,
required this.title,
required this.descriptions,
required this.text})
: super(key: key);

@override
_CustomDialogBoxState createState() => _CustomDialogBoxState();
Expand All @@ -24,55 +30,104 @@ class _CustomDialogBoxState extends State<CustomDialogBox> {
child: contentBox(context),
);
}
contentBox(context){

contentBox(context) {
return Stack(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: Constants.padding,top: Constants.avatarRadius
+ Constants.padding, right: Constants.padding,bottom: Constants.padding
),
padding: EdgeInsets.only(
left: Constants.padding,
top: Constants.avatarRadius + Constants.padding,
right: Constants.padding,
bottom: Constants.padding),
margin: EdgeInsets.only(top: Constants.avatarRadius),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(Constants.padding),
boxShadow: [
BoxShadow(color: Colors.black,offset: Offset(0,10),
blurRadius: 10
),
]
),
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.circular(Constants.padding),
boxShadow: [
BoxShadow(
color: Colors.black, offset: Offset(0, 10), blurRadius: 10),
]),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(widget.title,style: TextStyle(fontSize: 22,fontWeight: FontWeight.w600),),
SizedBox(height: 15,),
Text(widget.descriptions,style: TextStyle(fontSize: 14),textAlign: TextAlign.center,),
SizedBox(height: 22,),
// NeumorphicText(
// widget.title,
// textAlign: TextAlign.center,
// style: NeumorphicStyle(
// depth:20,
// intensity: 1,
// color: Colors.black),
// textStyle: NeumorphicTextStyle(
// fontSize: 20,
// fontWeight: FontWeight.w600,
// ),),
SizedBox(
height: 15,
),
NeumorphicText(
widget.descriptions,
textAlign: TextAlign.center,
style: NeumorphicStyle(
depth: 0, intensity: 0, color: Colors.black54),
textStyle: NeumorphicTextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 22,
),
Align(
alignment: Alignment.bottomRight,
alignment: Alignment(1.2, 5.0),
child: ElevatedButton(
onPressed: (){
Navigator.of(context).pop();
},
child: Text(widget.text,style: TextStyle(fontSize: 18),)),
),
// style: ButtonStyle(
// backgroundColor: MaterialStateProperty.all(Colors.black38),
// ),
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Colors.black,
shape: const CircleBorder(
side: BorderSide(
color: Colors.black,
width: 1,
style: BorderStyle.solid,
),
),
),

onPressed: () {
Navigator.of(context).pop();
},
child: NeumorphicText(
widget.text,
// textAlign: TextAlign.center,
style: NeumorphicStyle(
depth: 20, intensity: 0.5, color: Colors.white),
textStyle: NeumorphicTextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
),
),
),
)
],
),
),
Positioned(
left: Constants.padding,
right: Constants.padding,
child: CircleAvatar(
backgroundColor: Colors.transparent,
radius: Constants.avatarRadius,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(Constants.avatarRadius)),
child: Image.asset("assets/model.jpg")
),
),
right: Constants.padding,
child: CircleAvatar(
backgroundColor: Colors.transparent,
radius: Constants.avatarRadius,
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(Constants.avatarRadius)),
child: Image.asset("assets/model.jpg")),
),
),
],
);
}
}
}
34 changes: 30 additions & 4 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:kiatsu/model/entitlement.dart';
Expand Down Expand Up @@ -85,7 +86,7 @@ class HomePage extends riv.ConsumerWidget {
return CustomDialogBox(
title: "てへぺろ☆(ゝω・)vキャピ",
descriptions: "この機能はまだ未実装です♡",
text: "おけまる",
text: "",
key: UniqueKey(),
);
});
Expand Down Expand Up @@ -378,7 +379,7 @@ class HomePage extends riv.ConsumerWidget {
return CustomDialogBox(
title: "てへぺろ☆(ゝω・)vキャピ",
descriptions: "この機能はまだ未実装です♡",
text: "おけまる",
text: "",
key: UniqueKey(),
);
});
Expand All @@ -404,11 +405,36 @@ class HomePage extends riv.ConsumerWidget {

Widget buildAdmob(Entitlement entitlement) {
//TODO: #125 dispose()を呼び出す処理を書く
// 参考URL: https://uedive.net/2021/5410/flutter2-gad/
String getTestBannerUnitID() {
String testBannerUnitId = '';
if (Platform.isIOS) {
testBannerUnitId = 'ca-app-pub-3940256099942544/2934735716';
} else if (Platform.isAndroid) {
testBannerUnitId = 'ca-app-pub-3940256099942544/6300978111';
}
return testBannerUnitId;
}
final BannerAd myBanner = BannerAd(
adUnitId: 'ca-app-pub-3940256099942544/6300978111',
adUnitId: getTestBannerUnitID(),
size: AdSize.banner,
request: AdRequest(),
listener: BannerAdListener(),
listener:
// BannerAdListener(),
BannerAdListener(
// 広告が正常にロードされたときに呼ばれます。
onAdLoaded: (Ad ad) => print('バナー広告がロードされました。'),
// 広告のロードが失敗した際に呼ばれます。
onAdFailedToLoad: (Ad ad, LoadAdError error) {
print('バナー広告のロードに失敗しました。: $error');
},
// 広告が開かれたときに呼ばれます。
onAdOpened: (Ad ad) => print('バナー広告が開かれました。'),
// 広告が閉じられたときに呼ばれます。
onAdClosed: (Ad ad) => print('バナー広告が閉じられました。'),
// ユーザーがアプリを閉じるときに呼ばれます。
// onApplicationExit: (Ad ad) => print('ユーザーがアプリを離れました。'),
),
);
myBanner.load();
final AdWidget adWidget = AdWidget(ad: myBanner);
Expand Down
1 change: 1 addition & 0 deletions lib/pages/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:wiredash/wiredash.dart';


//TODO: #115 サインアップ時に設定ページの表示が更新されるようにする
//TODO: Android版の文字の色を変える

final FirebaseAuth firebaseAuth = FirebaseAuth.instance;
final FirebaseFirestore firebaseStore = FirebaseFirestore.instance;
Expand Down
69 changes: 47 additions & 22 deletions lib/pages/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_neumorphic/flutter_neumorphic.dart' as neu;
import 'package:flutter_neumorphic/flutter_neumorphic.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:kiatsu/utils/providers.dart';
Expand Down Expand Up @@ -172,30 +173,54 @@ class Timeline extends ConsumerWidget {
cityName.toString(), ref));
return Container();
},
success: (data) => TextButton(
onPressed: () async {
await users
.doc(currentUser!.uid)
.collection('comments')
.doc()
.set({
'comment': _editor.text,
'createdAt': createdAt,
'userId': currentUser!.uid,
'location': data.name.toString(),
});
// print(createdAt.toString());
Navigator.of(context).pop();
},
child: neu.NeumorphicText(
'押',
style: neu.NeumorphicStyle(
color: Colors.black87,
success: (data) => ElevatedButton(
// style: ButtonStyle(
// backgroundColor: MaterialStateProperty.all(Colors.black38),
// ),
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Colors.black,
shape: const CircleBorder(
side: BorderSide(
color: Colors.black,
width: 1,
style: BorderStyle.solid,
),
),
),
textStyle: neu.NeumorphicTextStyle(
fontSize: 30,

onPressed: () async {
(_editor.text.isEmpty) ?
showDialog(
context: context,
builder: (context) =>
AlertDialog(
title: Text(
'コメントを入力してください')))
: await users
.doc(currentUser!.uid)
.collection('comments')
.doc()
.set({
'comment': _editor.text,
'createdAt': createdAt,
'userId': currentUser!.uid,
'location': data.name.toString(),
});
},
child: NeumorphicText(
'押',
// textAlign: TextAlign.center,
style: NeumorphicStyle(
depth: 20,
intensity: 0.5,
color: Colors.white),
textStyle: NeumorphicTextStyle(
fontSize: 20,
fontWeight: FontWeight.w700,
),
),
)),
),
loading: () => Container(),
error: (String? message) {
return SnackBar(
Expand Down

0 comments on commit f3fe13d

Please sign in to comment.