Flutter AppBarの形状を変えるサンプル

環境
Windows11 pro 64bit
Flutter 3.3.7

構文
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(xxx)
AppBarの形を変えるには、引数「shape」を使います。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"テスト",
),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)
),
),
body: Center(),
);
}
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( "テスト", ), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40) ), ), body: Center(), ); }
@override
 Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(
       title: Text(
         "テスト",
       ),
       shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(40)
       ),
     ),
     body: Center(),
   );
 }

 

Flutter

Posted by arkgame