質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

Dart

Dartは、Googleによって開発されたJavaScriptの代替となることを目的に作られた、ウェブ向けのプログラミング言語である。

Q&A

0回答

768閲覧

flutter BoxConstraints has a negative minimum height.The offending constraints were: BoxConstraints

gaa

総合スコア0

Flutter

Flutterは、iOSとAndroidのアプリを同じコードで開発するためのフレームワークです。オープンソースで開発言語はDart。双方のプラットフォームにおける高度な実行パフォーマンスと開発効率を提供することを目的としています。

Dart

Dartは、Googleによって開発されたJavaScriptの代替となることを目的に作られた、ウェブ向けのプログラミング言語である。

0グッド

0クリップ

投稿2022/05/02 02:03

前提

画面を作っている時にBoxConstraints has a negative minimum height.
The offending constraints were: BoxConstraints(w=375.0, h=-109.0; NOT NORMALIZED)というエラーが発生しました。このエラーに対してどうやったら解決できるかわかりません。 何方かわかる方は教えて貰えると助かります。

発生している問題・エラーメッセージ

BoxConstraints has a negative minimum height. The offending constraints were: BoxConstraints(w=375.0, h=-109.0; NOT NORMALIZED)```

該当のソースコード

dart

1import 'package:flutter/material.dart'; 2import 'package:flutter_localizations/flutter_localizations.dart'; 3import 'package:medicine/calendar_add_model.dart'; 4import 'package:medicine/utils.dart'; 5import 'package:provider/provider.dart'; 6 7class CalendarAddDate extends StatelessWidget { 8 9 Widget build(BuildContext context) { 10 return MaterialApp( 11 localizationsDelegates: const [ 12 GlobalCupertinoLocalizations.delegate, 13 GlobalMaterialLocalizations.delegate, 14 GlobalWidgetsLocalizations.delegate, 15 ], 16 supportedLocales: [ 17 const Locale('ja'), 18 ], 19 title: 'お薬手帳リスト', 20 theme: ThemeData( 21 primaryColor: Colors.pink[100], 22 ), 23 home: CalendarAddPage(), 24 ); 25 } 26} 27 28class CalendarAddPage extends StatelessWidget { 29 CalendarAddPage({this.dete}); 30 DateTime? dete; 31 32 Widget build(BuildContext context) { 33 final textEditingController = TextEditingController(); 34 return ChangeNotifierProvider<CalemdarAddModel>.value( 35 value: CalemdarAddModel(date: dete), 36 child: Consumer<CalemdarAddModel>( 37 builder: (context, model, child) { 38 return Scaffold( 39 appBar: AppBar( 40 backgroundColor: Colors.pink[100], 41 title: const Text('新しい予定'), 42 leading: IconButton( 43 onPressed: () { 44 Navigator.pop(context); 45 }, 46 icon: const Icon(Icons.arrow_back_ios), 47 ), 48 actions: <Widget>[ 49 TextButton( 50 onPressed: () async { 51 await addDialog(model, context); 52 }, 53 child: const Text('保存'), 54 ), 55 ], 56 ), 57 body: SingleChildScrollView( 58 padding: const EdgeInsets.all(14), 59 child: Column( 60 mainAxisSize: MainAxisSize.min, 61 children: <Widget>[ 62 Column( 63 crossAxisAlignment: CrossAxisAlignment.start, 64 children: <Widget>[ 65 //予定 66 SizedBox( 67 height: 40, 68 child: TextFormField( 69 style: const TextStyle(fontSize: 13), 70 decoration: const InputDecoration( 71 border: UnderlineInputBorder(), hintText: '予定'), 72 onChanged: (text) { 73 model.scheduleText = text; 74 }, 75 ), 76 ), 77 const SizedBox(height: 20), 78 Column( 79 crossAxisAlignment: CrossAxisAlignment.start, 80 children: [ 81 //開始時間 82 const Text('開始時間', 83 style: TextStyle(fontWeight: FontWeight.bold)), 84 Row( 85 children: [ 86 Expanded( 87 flex: 2, 88 child: buildDropdownField( 89 text: model.startDate == "" 90 ? Utils.toDate(model.dateTime()) 91 : Utils.toDate(model.fromDate), 92 onClicked: () { 93 model.pickStartDateTime(context, 94 pickDate: true); 95 }), 96 ), 97 Expanded( 98 child: buildDropdownField( 99 text: model.startDate == "" 100 ? Utils.toTime(model.dateTime()) 101 : Utils.toTime(model.fromDate), 102 onClicked: () { 103 model.pickStartDateTime(context, 104 pickDate: false); 105 })), 106 ], 107 ), 108 //終了時間 109 const Text('終了時間', 110 style: TextStyle(fontWeight: FontWeight.bold)), 111 Row( 112 children: [ 113 Expanded( 114 flex: 2, 115 child: buildDropdownField( 116 text: model.endDate == "" 117 ? Utils.toDate(model.dateTime()) 118 : Utils.toDate(model.toDate), 119 onClicked: () { 120 model.pickEndDateTime(context, 121 pickDate: true); 122 }), 123 ), 124 Expanded( 125 child: buildDropdownField( 126 text: model.endDate == "" 127 ? Utils.toTime(model.dateTime()) 128 : Utils.toTime(model.toDate), 129 onClicked: () { 130 model.pickEndDateTime(context, 131 pickDate: false); 132 })), 133 ], 134 ), 135 ], 136 ), 137 const SizedBox(height: 20), 138 TextField( 139 decoration: const InputDecoration( 140 hintText: "病院名または診察科目を検索", 141 prefixIcon: Icon(Icons.note_alt), 142 border: OutlineInputBorder( 143 borderRadius: 144 BorderRadius.all(Radius.circular(25.0)))), 145 onChanged: (text) { 146 model.memoText = text; 147 }, 148 ), 149 ], 150 ), 151 ], 152 ), 153 ), 154 ); 155 }, 156 ), 157 ); 158 }

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問