diff --git a/lib/pages/custom_dialog_box.dart b/lib/pages/custom_dialog_box.dart index 95c0fb9..a8e6e38 100644 --- a/lib/pages/custom_dialog_box.dart +++ b/lib/pages/custom_dialog_box.dart @@ -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(); @@ -24,55 +30,104 @@ class _CustomDialogBoxState extends State { child: contentBox(context), ); } - contentBox(context){ + + contentBox(context) { return Stack( children: [ 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: [ - 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")), + ), ), ], ); } -} \ No newline at end of file +} diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 226fd1b..8a7d229 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -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'; @@ -85,7 +86,7 @@ class HomePage extends riv.ConsumerWidget { return CustomDialogBox( title: "てへぺろ☆(ゝω・)vキャピ", descriptions: "この機能はまだ未実装です♡", - text: "おけまる", + text: "押", key: UniqueKey(), ); }); @@ -378,7 +379,7 @@ class HomePage extends riv.ConsumerWidget { return CustomDialogBox( title: "てへぺろ☆(ゝω・)vキャピ", descriptions: "この機能はまだ未実装です♡", - text: "おけまる", + text: "押", key: UniqueKey(), ); }); @@ -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); diff --git a/lib/pages/setting_page.dart b/lib/pages/setting_page.dart index bd9bb74..83046bd 100644 --- a/lib/pages/setting_page.dart +++ b/lib/pages/setting_page.dart @@ -15,6 +15,7 @@ import 'package:wiredash/wiredash.dart'; //TODO: #115 サインアップ時に設定ページの表示が更新されるようにする +//TODO: Android版の文字の色を変える final FirebaseAuth firebaseAuth = FirebaseAuth.instance; final FirebaseFirestore firebaseStore = FirebaseFirestore.instance; diff --git a/lib/pages/timeline.dart b/lib/pages/timeline.dart index adba765..d73174a 100644 --- a/lib/pages/timeline.dart +++ b/lib/pages/timeline.dart @@ -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'; @@ -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(