简体   繁体   中英

How to use custom images in a flutter app

I am just graduating and am working on my first app via an internship. The school taught me ionic/angular but this customer wants to use flutter which I have no experience. I have succeeded with demo apps running in chrome.

I am following this example here .

But I get an error here trying to extend the Decoration class:

class CircleTabIndicator extends **Decoration** {
    final BoxPainter _painter;

It says:

Classes can only extend other classes. Try specifying a different superclass, or removing the extends clause.

I am new to flutter so I do not understand why one class exists in a project and not the other. I see no mention of an import or anything. Also there only seems to be one type of project the flutter create produces so this is quite confusing.

What I really need to do is use custom icons in a tab app. i have the tabs working with icons that I assume are default icons that come with flutter. I used this example and it worked flawlessly.

Just add

import 'package:flutter/material.dart';

at the top of the file you're declaring CircleTabIndicator .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM